int ledPin = 12; // Declare pin 11 for LED
int photoPin = 3; // variable resistor on analog pin 0
int photoValue = 0;
int boo = 0;
void setup() // run once, when the sketch starts
{
Serial.begin(9600);
pinMode(ledPin,OUTPUT); // set led pin 12 as OUTPUT
pinMode(photoPin,OUTPUT); // set analog pin 3 as OUTPUT
}
void loop() { // run over and over again
photoValue = analogRead(photoPin); // set val equal to the resistor input
boo = (photoValue/ 3) * 40;
Serial.println(boo);
analogWrite(ledPin, boo);
delay(100);
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment