Writing Your Name with the 7 Segment Display
After uploading the software, our task was to make our name display. A few of our materials, we the breadboard and the letters. For the first step, Nelson and I took and kept the upper two parts of the program. We kept it the same and didn't change the upper parts that was used for the earlier program. In the loop part, we created the code that made up the letters in our name. After that, the letters "R" and "N" soon appeared.
The pictures up above show a R and an N being flashed. The program below shows how it was done.
This is the code
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