Comments: Using the Serial 7-Segment Display


Comments 1 comment

  • ——————– Tech Support Tips/Troubleshooting/Common Issues ——————–

    Default Firmware

    If you are having issues uploading the default firmware try using the older version of the firmware branched here => [ ]. This is the same firmware that is used in our production department.

    Microcontroller Sending Commands Too Fast to Serial 7-Segment Display

    If you have issues using the serial enabled 7-segment display where the LEDs flicker and display random numbers, it could be the way that you wrote your code. There was one case that I encountered where this happened after using a sequence of commands to clearing the screen, setting the mode, setting the brightness, and adjusting the cursor.

    Testing with a 5V RedBoard, the major issues that seemed to be fixed was removing the clearDisplay() function and adding a delay between setting the brightness and your cursor position. The flickering may be due to clearing the screen and writing back on the screen in your main function. By avoiding the clear screen function every time my main function looped back, the serial enabled 7-segment displayed the counter better. By adding a 1ms delay, the serial enabled 7-segment stopped displaying random numbers and flickering. It’s possible that the serial enabled 7-segment display does not have enough time to set the brightness for the entire display. Adding the delay probably helped in completing the function before moving onto the next command.

    void loop(){
    //1) Reset Command (0x76) in a one byte write (one CS cycle)
    //clearDisplaySPI(); //try not to use so much, will cause flickering when constantly clearing and displaying
    //2) Mode Command (0x82) followed by Data Mode (0x00) in a two byte write (one CS cycle)
    digitalWrite(ssPin, LOW);
    SPI.transfer(0x82);//command character for mode
    SPI.transfer(0x00);//data mode
    digitalWrite(ssPin, HIGH);
    //3) Brightness Command (0x7A) followed by Value (0xC0) in a two byte write (one CS cycle)
    /*make sure to have the modular setBrightnessSPI()function defined
    from the example code => */
    setBrightnessSPI(0xC0);//brightness 0xC0 = 0d192
    delay(1);//add delay to finish this function before moving on
    //4) Cursor Position Command (0x79) followed by Value (0x00) in a two byte write (one CS cycle)
    digitalWrite(ssPin, LOW);
    SPI.transfer(0x79);//command character cursor position
    SPI.transfer(0x00);//cursor position on the left most position
    digitalWrite(ssPin, HIGH);
    //rest of SPI example code with Arduino

    Arduino Compile Issues w/ “0”

    If you are trying to send a special command and a data byte of 0, the compiler won’t like:


    It will output an error similar to this:

     ... error: call of overloaded 'write(int)' is ambiguous
    C:\Program Files (x86)\Arduino\libraries\SoftwareSerial/SoftwareSerial.h:123: note: candidates are: virtual size_t SoftwareSerial::write(uint8_t)
    C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Print.h:49: note:                 size_t Print::write(const char*)

    The value 0x00 is not specifically defined so it could be a char(NULL), int, or a byte. The compiler doesn’t understand what you are referring to. To work around this, try saving the byte into a defined variable and using it with the Serial.write() function similar to this:

    byte zero = 0;

    Default I2C Address on Other Microcontrollers

    The Arduino I2C library uses 7-bit addressing [ ]. I believe the library ignores the last bit because there is a function for reading or writing. Other development boards outside of the Arduino ecosystem may require different addressing techniques. This was stated briefly in the I2C example code:

    Please Note: 0x71 is the 7-bit I2C address. If you are using a different language than Arduino you will probably

    need to add the Read/Write bit to the end of the address. This means the default read address for the OpenSegment is 0b.1110.0011 or 0xE3 and the write address is 0b.1110.0010 or 0xE2. For more information see .

    Additional Tutorials and Examples

    For an example using the serial 7-segment display with Raspberry Pi, I2C, and Python, check out this tutorial =>

    For an example using the 7-segment serial display with Raspberry Pi, I2C, and MatLab support package, check here =>

If you've found a bug or have other constructive feedback for our tutorial authors, please send us your feedback!