Created
July 28, 2015 21:29
-
-
Save pbassut/2c8689fa67f896f08c73 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int greenLEDPin = 9; | |
const int redLEDPin = 11; | |
const int blueLEDPin = 10; | |
void changeLED(int r, int g, int b) { | |
analogWrite(greenLEDPin, r); | |
analogWrite(redLEDPin, g); | |
analogWrite(blueLEDPin, b); | |
} | |
void setup() { | |
Serial.begin(9600); | |
pinMode(greenLEDPin, OUTPUT); | |
pinMode(redLEDPin, OUTPUT); | |
pinMode(blueLEDPin, OUTPUT); | |
analogWrite(greenLEDPin, 0); | |
analogWrite(redLEDPin, 0); | |
analogWrite(blueLEDPin, 0); | |
} | |
void loop() { | |
const int speed = 1; | |
int factor = 1; | |
for (int i = 0x000000;; i += factor*speed) { | |
//changeLED(b, g, r); | |
printf("%x ", i); | |
printf("%x %x %x\n", (i & 0xFF0000) >> 16, (i & 0xFF00) >> 8, (i & 0xFF)); | |
if(i > 3*256){ | |
factor *= -1; | |
}else if(i < 0){ | |
factor *= -1; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment