Skip to content

Instantly share code, notes, and snippets.

@julioterra
Last active December 16, 2015 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save julioterra/5463871 to your computer and use it in GitHub Desktop.
Save julioterra/5463871 to your computer and use it in GitHub Desktop.
void setup() {
// open serial port
Serial.begin(9600);
}
void loop() {
// read and send the value of analog sensor
long raw_val = analogRead(A0);
// use to adjust the range, if necessary
// int range_offet = 3;
// int range_size = 60;
// raw_val = raw_val - range_offet;
// raw_val = constrain( (raw_val * 1023 / range_size), 0, 1023);
Serial.println(raw_val);
// wait to send the next value so that you
// don't clog up the serial port
delay(100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment