Skip to content

Instantly share code, notes, and snippets.

@theantonius
Created March 11, 2015 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theantonius/2bb2557dc85ed538eafe to your computer and use it in GitHub Desktop.
Save theantonius/2bb2557dc85ed538eafe to your computer and use it in GitHub Desktop.
int led = 9;
int sensor = A0;
int sensorValue = 255;
int calibration = 15;
void setup(){
pinMode(led, OUTPUT);
Serial.begin(9600);
}
void loop(){
Serial.println(analogRead(0));
sensorValue = map(analogRead(0),0,calibration,0,255);
analogWrite(led, sensorValue);
delay(10);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment