Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const int REDPin=11;
- const int GREENPin=10;
- const int BLUEPin=9;
- const int PotPin=A0;
- int ReadValue;
- int RedVal;
- int GreenVal;
- int BlueVal;
- void setup()
- {
- pinMode(REDPin, OUTPUT);
- pinMode(GREENPin, OUTPUT);
- pinMode(BLUEPin, OUTPUT);
- pinMode (PotPin, INPUT);
- Serial.begin (9660);
- }
- void loop()
- {
- ReadValue=analogRead(PotPin);
- RedVal = map(ReadValue, 0, 1023, 255, 0);
- BlueVal = map(ReadValue, 0, 1023, 0, 255);
- GreenVal = map (ReadValue, 0, 1023, 0, 125);
- analogWrite (REDPin, RedVal);
- analogWrite(GREENPin, GreenVal);
- analogWrite (BLUEPin, BlueVal);
- delay (200);
- // analogWrite (REDPin, 025);
- // analogWrite(GREENPin, 102);
- // analogWrite (BLUEPin, 102);
- // delay (200);
- // analogWrite (REDPin, 127);
- // analogWrite(GREENPin, 102);
- // analogWrite (BLUEPin, 102);
- // delay (200);
- }
Add Comment
Please, Sign In to add comment