SunFounder ESP32 Starter Kit
Code
Note:
• Open the 2.5_7segment.ino file under the path of esp32-starter-kit-main\c\codes\2.5_7segment.
• After selecting the board (ESP32 Dev Module) and the appropriate port, click the Upload button.
• Always displaying “Unknown COMxx”?
After the code is uploaded successfully, you will be able to see the LED Segment Display display 0~9 in sequence.
How it works?
In this project, we are using the shiftOut() function to write the binary number to the shift register.
Suppose that the 7-segment Display display the number “2”. This bit pattern corresponds to the segments f, c and dp
being turned off (low), while the segments a, b, d, e and g are turned on (high). This is “01011011” in binary and
“0x5b” in hexadecimal notation.
Therefore, you would need to call shiftOut(DS,SHcp,MSBFIRST,0x5b) to display the number “2” on the 7-segment
display.
• Hexadecimal
• BinaryHex Converter
The following table shows the hexadecimal patterns that need to be written to the shift register to display the numbers
0 to 9 on a 7-segment display.
1.9. 2.5 7 Segment Display 37