Skip to content

Instantly share code, notes, and snippets.

@reefwing
Created January 14, 2023 23:48
Show Gist options
  • Save reefwing/c3a6c051bed94432304160ac402ccb17 to your computer and use it in GitHub Desktop.
Save reefwing/c3a6c051bed94432304160ac402ccb17 to your computer and use it in GitHub Desktop.
Code snippet to show reading and displaying the potentiometer value
1. float pot = (((float)analogRead(VPOT) + 0.5) / 1024.0) * 100.0;
2.
3. itoa((int)pot, throttleAsChar, DECIMAL); // itoa = Int to ASCII
4. u8x8.drawString(1, 4, "THROTTLE: ");
5. u8x8.drawString(10, 4, throttleAsChar);
6. u8x8.drawString(14, 4, "%");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment