Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define blue 3
- #define green 5
- #define red 6
- char blueC = "b";
- char greenC = "g";
- char redC = "r";
- void setup() {
- // put your setup code here, to run once:
- pinMode(3, OUTPUT);
- pinMode(5, OUTPUT);
- pinMode(6, OUTPUT);
- Serial.begin(9600);
- }
- void loop() {
- // put your main code here, to run repeatedly:
- char c;
- if(Serial.available()){
- c = Serial.read();
- if(c == 'r'){
- analogWrite(red, 0);
- analogWrite(blue, 255);
- analogWrite(green, 255);
- }else if(c == 'b'){
- analogWrite(blue, 0);
- analogWrite(red, 255);
- analogWrite(green, 255);
- }else if(c == 'g'){
- analogWrite(green, 0);
- analogWrite(blue, 255);
- analogWrite(red, 255);
- }else{
- Serial.println();
- }
- }
- delay(500);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement