Skip to content

Instantly share code, notes, and snippets.

@electronut
Created May 24, 2013 07:45
Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save electronut/5641938 to your computer and use it in GitHub Desktop.
Save electronut/5641938 to your computer and use it in GitHub Desktop.
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