Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const int PhotoR = A0;
- const int LEDpin = 5;
- int ReadValue = 0;
- void setup()
- {
- pinMode (PhotoR, INPUT);
- pinMode (LEDpin, OUTPUT);
- Serial.begin(9600);
- }
- void loop()
- {
- ReadValue = analogRead(PhotoR);
- ReadValue = map(ReadValue, 13, 493, 255, 0);
- ReadValue = constrain(ReadValue, 0, 255);
- Serial.println(ReadValue);
- analogWrite(LEDpin, ReadValue);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement