Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const int R = 9;
- const int G = 11;
- const int B = 10;
- const int PhotoR = A5;
- int PhotoRValue = 0;
- void setup()
- {
- pinMode(R, OUTPUT);
- pinMode(G, OUTPUT);
- pinMode(B, OUTPUT);
- pinMode(PhotoR, INPUT);
- analogWrite(G, 255);
- }
- void loop()
- {
- int brightness = 0;
- PhotoRValue = analogRead(A5);
- brightness = PhotoRValue;
- brightness = map(brightness, 0, 1023, 0, 255);
- analogWrite(G,brightness);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement