Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ATTINY 45 RGB LED FOR THE BLING THING
- */
- int redPin = 0;
- int greenPin = 1;
- int bluePin = 3;
- void setup()
- {
- pinMode(redPin, OUTPUT);
- pinMode(greenPin, OUTPUT);
- pinMode(bluePin, OUTPUT);
- }
- void loop()
- {
- setColor(255, 0, 0); // red
- delay(1000);
- setColor(0, 255, 0); // green
- delay(1000);
- setColor(0, 0, 255); // blue
- delay(1000);
- setColor(255, 255, 0); // yellow
- delay(1000);
- setColor(128, 0, 128); // purple
- delay(1000);
- setColor(0, 255, 255); // aqua
- delay(1000);
- setColor(128, 128, 0); //olive
- delay(1000);
- setColor(0, 128, 128); //teal
- delay(1000);
- }
- void setColor(int red, int green, int blue)
- {
- analogWrite(redPin, red);
- analogWrite(greenPin, green);
- analogWrite(bluePin, blue);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement