For this post, our task was to have our name appear with a 7 segment display. A seven-segment is a electronic piece used to display numbers. To make this happen, we had to use certain materials. We used the bread board, LED lights, about 5 receptors and a SSD. Then, we kept the top part of the program the same. After you begin the loop part. For the loop part, we then entered the a code. A R for Ruth and a N for Nelson then appeared. We not only had the ability to flash our names, but we could turn them off right after.
This was the code used below:
void loop() {
digitalWrite(ledB, HIGH); // draw a R
digitalWrite(ledC, HIGH);
digitalWrite(ledD, HIGH);
delay(2000); // wait for 2 second
digitalWrite(ledB, LOW);
digitalWrite(ledC, LOW);
digitalWrite(ledD, LOW); // turn off R
digitalWrite(ledE, HIGH);
digitalWrite(ledF, HIGH); // turn on N
digitalWrite(ledA, HIGH);
digitalWrite(ledB, HIGH);
digitalWrite(ledC, HIGH);
digitalWrite(ledG, HIGH);
delay(2000);
digitalWrite(ledE, LOW);
digitalWrite(ledF, LOW);
digitalWrite(ledA, LOW); turn off N
digitalWrite(ledB, LOW);
digitalWrite(ledC, LOW);
digitalWrite(ledG, LOW);
}
No comments:
Post a Comment