Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //const int Button=7;
- const int PhotoPin=A0;
- const int LEDPin=5;
- int ReadValue=0;
- void setup()
- {
- pinMode (PhotoPin, INPUT);
- Serial.begin(9600);
- // put your setup code here, to run once:
- }
- void loop()
- {
- ReadValue=analogRead(PhotoPin);
- ReadValue=map (ReadValue,170,15,0,255);
- //these numbers indicate min (15) and max (170) and it inserts it into the readvalue)
- Serial.println(ReadValue);
- analogWrite (LEDPin, ReadValue);
- // put your main code here, to run repeatedly:
- }
Add Comment
Please, Sign In to add comment