Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const int photo_resist=A1;
- int PhotoVal;
- const int PinLed1 = 5;
- const int PinLed2 = 6;
- const int PinLed3 = 9;
- void setup() {
- // put your setup code here, to run once:
- Serial.begin(9600);
- pinMode (photo_resist, INPUT);
- pinMode(PinLed1, OUTPUT);
- pinMode(PinLed2, OUTPUT);
- pinMode(PinLed3, OUTPUT);
- }
- void loop() {
- // put your main code here, to run repeatedly:
- PhotoVal = analogRead(photo_resist);
- Serial.println(PhotoVal);
- PhotoVal = map(PhotoVal, 300,500,255,0);
- analogWrite(PinLed1, PhotoVal);
- analogWrite(PinLed2, PhotoVal);
- analogWrite(PinLed3, PhotoVal);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement