Skip to content

Instantly share code, notes, and snippets.

@tagliati
Created December 9, 2012 18:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tagliati/4246395 to your computer and use it in GitHub Desktop.
Save tagliati/4246395 to your computer and use it in GitHub Desktop.
Reading LDR value.
const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
int sensorValue = 0; // value read from the pot
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
}
void loop() {
sensorValue = analogRead(analogInPin);
Serial.print("sensor = " );
Serial.print(sensorValue);
Serial.print("\t\n");
delay(1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment