Objectives: Learn how LED displays work Be able to output your name on the display By the end of this session: You will know how simple LED displays work and be able to make them give a useful output. © S. Pithouse for use by Warwick Technology Volunteers Page: 1 Arduino Uno 7 segment displays are used in many common every day items, from digital alarm clocks, to cooker timer displays and some calculator screens. They are just a collection of LEDs wired together with their GND legs all routed to a single GND pin. The PCB contains resistors to allow you to just plug it straight into the Arduino! 7-Segment PCB 5x7 dot matrix displays are used in large outdoor TV screens and occasionally in shop window signs, they work on a similar principle to the 7 segment displays. 5x7 Dot Matrix Shield © S. Pithouse for use by Warwick Technology Volunteers Page: 2 1) Insert the 7-segment display PCB into the Arduino as shown in the diagram. 2) For the second part of the tutorial, you will have to insert the 5x7 Dot Matrix shield into the Arduino as shown in the diagram. © S. Pithouse for use by Warwick Technology Volunteers Page: 3 1) Plug the USB cable into the Arduino and Computer, then open the Arduino Program. 2) You will type the program from scratch and will not need to copy a template program. 3) The LEDs in the 7-segment display are connected as shown: To turn an LED 9 ON digitalWrite(9, HIGH); To turn an LED 9 OFF digitalWrite(9, LOW); © S. Pithouse for use by Warwick Technology Volunteers Page: 4 4) Firstly, you will have to tell the Arduino that the LEDs are connected and that they are OUTPUTS: 5) To begin with, we will make the display show the number 1: 6) Upload the program by clicking on the upload button. © S. Pithouse for use by Warwick Technology Volunteers Page: 5 7) You should see the display showing the number 1: 8) Now, lets make the display count up to 9… you must add digitalWrite statements before the last curly brace’}’ , then delay for 1 second: © S. Pithouse for use by Warwick Technology Volunteers Page: 6 9) Upload the program by clicking on the upload button. 10) Now that you have made it show 1 and 2, make it count from 0, up to 9: 11) Now, remove the 7-segment display and connect the Dot Matrix shied as shown in step 2 on page 3. Copy the template program from the website into a new Arduino window and upload the program: © S. Pithouse for use by Warwick Technology Volunteers Page: 7 12) You will notice that the program is long and looks complicated, do not panic, it is not too bad! Look towards the start of the program, and you will see lines which look like the following diagram. If you look carefully, you will see that the 1’s represents the LEDs that are on, and the 0’s represent the LEDs that are off! 13) By changing the 1’s and 0’s, you can change the pattern on the display. Try changing the numbers to match the diagram, and upload the program! © S. Pithouse for use by Warwick Technology Volunteers Page: 8 14) Using the diagram below, make it display the first letter of your name: 15) Upload the program by clicking on the upload button. © S. Pithouse for use by Warwick Technology Volunteers Page: 9 16) Notice the loop function, it says showLetter(0), this uses the first set of numbers, if you add the following line of code and upload it, it will show the second set of numbers. showLetter(0) showLetter(1) 17) Change the second letter’s corresponding numbers to show the first letter of your Surname. Upload the program. 18) Now, you can make it scroll across the screen by replacing the showLetter() functions with scrollText(200); The 200 represents the time in ms that each frame is shown. © S. Pithouse for use by Warwick Technology Volunteers Page: 10 Extension Task You can expand the display to show more letters, the next steps show you how to add more letters so that you can display your name! Firstly, find the line very near to the start of the program which looks like this: Change the number to 3, so that it looks like this: Finally, select the lines highlighted below, copy them and paste them as shown below: After Before Simply change the 1’s and 0’s in this new section to show the next letter. Repeat this process for more letters. © S. Pithouse for use by Warwick Technology Volunteers Page: 11