Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- *Divya Inaganti
- *June 14, 2017
- *How to use a photoresistor activity
- */
- const int PinRed= 9;
- const int PinGreen=10;
- const int PinBlue= 11;
- void setup()
- {
- Serial.begin (9600);
- // pinMode(photoPin, INPUT);
- pinMode (PinRed, OUTPUT);
- pinMode (PinGreen, OUTPUT);
- pinMode (PinBlue, OUTPUT);
- analogWrite(PinRed, 255);
- analogWrite(PinGreen, 0);
- analogWrite(PinBlue,0);
- delay(200);
- analogWrite(PinRed, 0);
- analogWrite(PinGreen, 255);
- analogWrite(PinBlue,0);
- delay(200);
- analogWrite(PinRed, 0);
- analogWrite(PinGreen, 0);
- analogWrite(PinBlue,255);
- delay(200);
- }
- void loop()
- {
- //
- //
- //Read (photoPin);
- // lightVal= map(photoValue, 0, 1020, 255, 0);
- // Serial.print ("Photoresistor value = ");
- // Serial.print(photoValue);
- // Serial.print ("lightVal = ");
- // Serial.println(lightVal);
- // delay(100);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement