Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Jung Min Yean
- * 03/28/19
- * Learning How to Use a Photoresistor
- */
- const int LedPin1 = 9;
- const int LedPin2 = 10;
- const int LedPin3 = 11;
- const int PhotoPin = A0;
- const int PotPin = A1;
- int PotVal = 0;
- int PhotoVal = 0;
- void setup()
- {
- pinMode(LedPin1, OUTPUT);
- pinMode(LedPin2, OUTPUT);
- pinMode(LedPin3, OUTPUT);
- pinMode(PotPin, INPUT);
- pinMode(PhotoPin, INPUT);
- Serial.begin(9600);
- }
- void loop()
- {
- // test potentiometer
- PotVal = analogRead(PotPin);
- PhotoVal = analogRead(PhotoPin);
- Serial.println(PhotoVal);
- // Serial.print(" ");
- // int MapValue = map(PotVal,0,1023,255,0);
- // Serial.println(MapValue);
- // analogWrite(LedPin1, PotVal);
- // analogWrite(LedPin2, PotVal);
- // analogWrite(LedPin3, PotVal);
- }
RAW Paste Data