Skip to content

Instantly share code, notes, and snippets.

@msantos
Created April 13, 2010 00:49
Show Gist options
  • Save msantos/364190 to your computer and use it in GitHub Desktop.
Save msantos/364190 to your computer and use it in GitHub Desktop.
int LDR = 2;
int val = 0;
int inb = 0;
void setup() {
Serial.begin(9600);
pinMode(LDR, INPUT);
}
void loop() {
if (Serial.available() > 0) {
inb = Serial.read();
if (inb == '1') {
val = analogRead(LDR);
//Serial.println(val);
Serial.print(val);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment