Varying Speed:
Woo! Simple input change.
void setup() {
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(13, HIGH);
delay(250);
digitalWrite(13, LOW);
delay(250);
}
Alternating:
The interesting part of this was working the breadboard correctly. There were certain rules about it I didn't understand just from the lecture.
void setup() {
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
}
void loop() {
digitalWrite(8, HIGH);
delay(500);
digitalWrite(8, LOW);
delay(500);
digitalWrite(9, HIGH);
delay(500);
digitalWrite(9, LOW);
delay(500);
}
Incrementing:
Pretty straight-forward variable declaration and incrementation inside a for loop.
int increment = 0;
void setup() {
pinMode(13, OUTPUT);
}
void loop() {
for (int i = 0; i <= increment; i++) {
digitalWrite(13, HIGH);
delay(150);
digitalWrite(13, LOW);
delay(150);
}
increment++;
delay(1000);
}
Sarah Oakes
with partner Maureen McLennon
No comments:
Post a Comment