Last active
April 2, 2017 15:22
-
-
Save Oppodelldog/f156b37d774260573b12a1b4b881f158 to your computer and use it in GitHub Desktop.
arduino uno - send analog input values via serial connection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int sensors[]{A0,A1,A2,A3,A4,A5}; | |
void setup() | |
{ | |
Serial.begin(9600); | |
} | |
void loop() | |
{ | |
int numberOfSensors = sizeof(sensors)/sizeof(int); | |
for (int i = 0; i < numberOfSensors; i++) { | |
int value = analogRead(sensors[i]); | |
Serial.print(sensors[i]); | |
Serial.print(":"); | |
char valueString[5]; | |
sprintf(valueString,"%05d",value); | |
Serial.print(valueString); | |
Serial.println(); | |
} | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment