belrey10

The Best Way to View Your HERO’s Data part 2

Nov 4th, 2024
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. // the setup routine runs once when you press reset:
  2. void setup() {
  3. // initialize serial communication at 9600 bits per second:
  4. Serial.begin(9600);
  5. }
  6.  
  7. // the loop routine runs over and over again forever:
  8. void loop() {
  9. // read the input on analog pin 0:
  10. int sensorValue = analogRead(A0);
  11. // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
  12. float voltage = sensorValue * (5.0 / 1023.0);
  13. // print out the value you read:
  14. Serial.println(voltage);
  15. }
  16.  
Tags: cogsworth
Add Comment
Please, Sign In to add comment