Group assignment
group project here
Individual assignment
int ledR = 0;
int ledG = 2;
int ledB = 1;
int swPin = 4;
byte number;
#include
SoftwareSerial mySerial(2, 3); // RX, TX
void setup() {
pinMode (ledR,OUTPUT);
pinMode (ledG,OUTPUT);
pinMode (ledB,OUTPUT);
pinMode (swPin,INPUT_PULLUP);
mySerial.begin(4800);
}
void loop() {
mySerial.println(number);
boolean push = digitalRead(swPin);
if(push == true){
// give me a number between 0 - 5 (inclusive)
number = random (0, 6);
}
if (number == 0) {
digitalWrite(ledB, HIGH);
digitalWrite(ledR, LOW);
digitalWrite(ledG, HIGH);
delay (100); }
if (number == 1) {
digitalWrite(ledR, HIGH);
digitalWrite(ledB, LOW);
digitalWrite(ledG, HIGH);
delay (100); }
if (number == 2) {
digitalWrite(ledB, HIGH);
digitalWrite(ledG, LOW);
digitalWrite(ledR, HIGH);
delay (100); }
if (number == 3) {
digitalWrite(ledG, LOW);
digitalWrite(ledR, LOW);
digitalWrite(ledB, HIGH);
delay (100); }
if (number == 4) {
digitalWrite(ledR, HIGH);
digitalWrite(ledG, LOW);
digitalWrite(ledB, LOW);
delay (100); }
if (number == 5) {
digitalWrite(ledR, LOW);
digitalWrite(ledB, LOW);
digitalWrite(ledG, HIGH);
delay (100); }
}