Skip to content

Instantly share code, notes, and snippets.

@cmoz
Created March 23, 2022 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmoz/bb47e587ba89859321e88b9bee3b2a86 to your computer and use it in GitHub Desktop.
Save cmoz/bb47e587ba89859321e88b9bee3b2a86 to your computer and use it in GitHub Desktop.
Reads in 4 analog values and outputs to serial plotter
/*
* Created by ArduinoGetStarted.com
*
* This example code is in the public domain
*
* Tutorial page: https://arduinogetstarted.com/tutorials/arduino-serial-plotter
*/
void setup() {
Serial.begin(9600);
}
void loop() {
int y1 = analogRead(A0);
int y2 = analogRead(A1);
int y3 = analogRead(A2);
int y4 = analogRead(A3);
Serial.print(y1);
Serial.print(" "); // a space ' ' or tab '\t' character is printed between the two values.
Serial.print(y2);
Serial.print(" "); // a space ' ' or tab '\t' character is printed between the two values.
Serial.print(y3);
Serial.print(" "); // a space ' ' or tab '\t' character is printed between the two values.
Serial.println(y4); // the last value is followed by a carriage return and a newline characters.
delay(100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment