Four Color LEDS

From BCRCWiki

(Difference between revisions)
Jump to: navigation, search
(Created page with "<code> const int RA = 0; const int GA = 1; const int BA = 2; const int RB = 3; const int GB = 4; const int BB = 5; const int RC = 7; const int GC = 8; const int BC = 9; const...")
 
Line 62: Line 62:
 +
</code>
 +
 +
version 2
 +
 +
<code>
 +
const int RA = 0; const int GA = 1; const int BA = 2;
 +
 +
const int RB = 3; const int GB = 4; const int BB = 5;
 +
 +
const int RC = 7; const int GC = 8; const int BC = 9;
 +
 +
const int RD = 11; const int GD = 12; const int BD = 12;
 +
 +
 +
void setup() {
 +
 +
pinMode(RA, OUTPUT); pinMode(GA, OUTPUT); pinMode(BA, OUTPUT);
 +
 +
pinMode(RB, OUTPUT); pinMode(GB, OUTPUT); pinMode(BB, OUTPUT);
 +
 +
pinMode(RC, OUTPUT); pinMode(GC, OUTPUT); pinMode(BC, OUTPUT);
 +
 +
pinMode(RD, OUTPUT); pinMode(GD, OUTPUT); pinMode(BD, OUTPUT); }
 +
 +
 +
void loop() {
 +
digitalWrite(RA, HIGH); digitalWrite(GA, LOW); digitalWrite(BA, LOW);
 +
digitalWrite(RB, LOW); digitalWrite(GB, HIGH); digitalWrite(BB, LOW);
 +
digitalWrite(RC, LOW); digitalWrite(GC, LOW); digitalWrite(BC, HIGH);
 +
digitalWrite(RD, HIGH); digitalWrite(GD, HIGH); digitalWrite(BD, HIGH);
 +
 +
delay(100);
 +
 +
digitalWrite(RA, LOW); digitalWrite(GA, HIGH); digitalWrite(BA, HIGH);
 +
digitalWrite(RB, HIGH); digitalWrite(GB, LOW); digitalWrite(BB, HIGH);
 +
digitalWrite(RC, HIGH); digitalWrite(GC, LOW); digitalWrite(BC, HIGH);
 +
digitalWrite(RD, LOW); digitalWrite(GD, LOW); digitalWrite(BD, LOW);
 +
 +
delay(100);
 +
 +
}
</code>
</code>

Latest revision as of 21:37, 10 November 2017

const int RA = 0; const int GA = 1; const int BA = 2;

const int RB = 3; const int GB = 4; const int BB = 5;

const int RC = 7; const int GC = 8; const int BC = 9;

const int RD = 11; const int GD = 12; const int BD = 12;


void setup() {

pinMode(RA, OUTPUT); pinMode(GA, OUTPUT); pinMode(BA, OUTPUT);

pinMode(RB, OUTPUT); pinMode(GB, OUTPUT); pinMode(BB, OUTPUT);

pinMode(RC, OUTPUT); pinMode(GC, OUTPUT); pinMode(BC, OUTPUT);

pinMode(RD, OUTPUT); pinMode(GD, OUTPUT); pinMode(BD, OUTPUT); }


void loop() { digitalWrite(RA, HIGH); digitalWrite(GA, LOW); digitalWrite(BA, LOW);

digitalWrite(RB, LOW); digitalWrite(GB, HIGH); digitalWrite(BB, LOW);

digitalWrite(RC, LOW); digitalWrite(GC, LOW); digitalWrite(BC, HIGH);

digitalWrite(RD, HIGH); digitalWrite(GD, HIGH); digitalWrite(BD, HIGH); }



version 2

const int RA = 0; const int GA = 1; const int BA = 2;

const int RB = 3; const int GB = 4; const int BB = 5;

const int RC = 7; const int GC = 8; const int BC = 9;

const int RD = 11; const int GD = 12; const int BD = 12;


void setup() {

pinMode(RA, OUTPUT); pinMode(GA, OUTPUT); pinMode(BA, OUTPUT);

pinMode(RB, OUTPUT); pinMode(GB, OUTPUT); pinMode(BB, OUTPUT);

pinMode(RC, OUTPUT); pinMode(GC, OUTPUT); pinMode(BC, OUTPUT);

pinMode(RD, OUTPUT); pinMode(GD, OUTPUT); pinMode(BD, OUTPUT); }


void loop() { digitalWrite(RA, HIGH); digitalWrite(GA, LOW); digitalWrite(BA, LOW); digitalWrite(RB, LOW); digitalWrite(GB, HIGH); digitalWrite(BB, LOW); digitalWrite(RC, LOW); digitalWrite(GC, LOW); digitalWrite(BC, HIGH); digitalWrite(RD, HIGH); digitalWrite(GD, HIGH); digitalWrite(BD, HIGH);

delay(100);

digitalWrite(RA, LOW); digitalWrite(GA, HIGH); digitalWrite(BA, HIGH); digitalWrite(RB, HIGH); digitalWrite(GB, LOW); digitalWrite(BB, HIGH); digitalWrite(RC, HIGH); digitalWrite(GC, LOW); digitalWrite(BC, HIGH); digitalWrite(RD, LOW); digitalWrite(GD, LOW); digitalWrite(BD, LOW);

delay(100);

}

Personal tools