13) mostly on than off.
[...]
digitalWrite(led1, HIGH);
digitalWrite(led2, LOW);
delay(1000);
digitalWrite(led2, HIGH);
delay(500);
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
[...]
----------------------------------------------------------------
14) now the opposite
[...]
digitalWrite(led2, HIGH);
digitalWrite(led1, LOW);
delay(1000);
digitalWrite(led1, HIGH);
delay(500);
digitalWrite(led2, LOW);
digitalWrite(led1, LOW);
[...]
----------------------------------------------------------------
15) will send email
----------------------------------------------------------------
16) get one led to blink once then repeat the other infinitely
//start of program
int powerOnLed = 13;
int blinkStatus = 12;
int num = 0;
void setup() {
pinMode(powerOnLed, OUTPUT);
pinMode(blinkStatus, OUTPUT);
}
void loop() {
while(num = 0) {
digitalWrite(powerOnLed, HIGH);
delay(1000);
digitalWrite(powerOnLed, LOW);
num = num + 1;
}
digitalWrite(blinkStatus, HIGH);
delay(1000);
digitalWrite(blinkStatus, LOW);
delay(1000);
}
--------------------------------------------------------------------
17) using the for loop SUCCESS!!
int ledPin1 = 13;
int ledPin2 = 12;
int t = 300;
void setup() {
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
}
void loop() {
int i = 0;
for(i=0;i<5;i++){
digitalWrite(ledPin1, HIGH);
delay(t);
digitalWrite(ledPin1,LOW);
delay(t);
}
digitalWrite(ledPin2, HIGH);
delay(t);
digitalWrite(ledPin2, LOW);
delay(t);
}
int ledPin1 = 13;
int ledPin2 = 12;
int t = 300;
void setup() {
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
}
void loop() {
int i = 0;
for(i=0;i<5;i++){
digitalWrite(ledPin1, HIGH);
delay(t);
digitalWrite(ledPin1,LOW);
delay(t);
}
digitalWrite(ledPin2, HIGH);
delay(t);
digitalWrite(ledPin2, LOW);
delay(t);
}
-----------------------------------------------------------------------------
18) same as above but different value
int ledPin1 = 13;
int ledPin2 = 12;
int t = 300;
void setup() {
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
}
void loop() {
int i = 0;
for(i=0;i<10;i++){
digitalWrite(ledPin1, HIGH);
delay(t);
digitalWrite(ledPin1,LOW);
delay(t);
}
digitalWrite(ledPin2, HIGH);
delay(t);
digitalWrite(ledPin2, LOW);
delay(t);
}
int ledPin1 = 13;
int ledPin2 = 12;
int t = 300;
void setup() {
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
}
void loop() {
int i = 0;
for(i=0;i<10;i++){
digitalWrite(ledPin1, HIGH);
delay(t);
digitalWrite(ledPin1,LOW);
delay(t);
}
digitalWrite(ledPin2, HIGH);
delay(t);
digitalWrite(ledPin2, LOW);
delay(t);
}
No comments:
Post a Comment