Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Read analog values from A0 and A1 and print them to serial port.
// analog-plot
//
// Read analog values from A0 and A1 and print them to serial port.
//
// electronut.in
#include "Arduino.h"
void setup()
{
// initialize serial comms
Serial.begin(9600);
}
void loop()
{
// read A0
int val1 = analogRead(0);
// read A1
int val2 = analogRead(1);
// print to serial
Serial.print(val1);
Serial.print(" ");
Serial.print(val2);
Serial.print("\n");
// wait
delay(50);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment