Skip to content

Commit 9f94cb6

Browse files
committed
Improved the software reset sketch. Uses strings now.
1 parent 55c028d commit 9f94cb6

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

firmware/Serial 7-Segment Display/Arduino_Examples/S7S_Example_Serial_SoftwareReset/S7S_Example_Serial_SoftwareReset.ino

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
Did you set your Serial7Segment display to a baud rate you don't know? This example sketch
1111
should get you fixed up! This example code sends the factory reset command at 12 different baud rates.
1212
13+
For more information see: http://github.com/sparkfun/Serial7SegmentDisplay/wiki/Special-Commands#wiki-reset
14+
1315
To get this code to work, attached an Serial7Segment to an Arduino Uno using the following pins:
1416
Pin 8 on Uno to RX on Serial7Segment
1517
VIN to PWR
@@ -29,22 +31,19 @@ void setup()
2931
Serial.println("Attempting to reset display to 9600bps...");
3032

3133
//Step through each available serial baud rate and send the factory reset command
32-
int baudRates[12] = {2400, 4800, 9600, 14400, 19200, 38400,
33-
57600, 7600, 115200, 250000, 500000, 1000000};
34+
int baudRates[12] = {2400, 4800, 9600, 14400, 19200, 38400, 57600, 7600, 115200, 250000, 500000, 1000000};
3435
for (int i = 0 ; i < 12 ; i++)
3536
{
3637
Serial7Segment.begin(baudRates[i]); // Set new baud rate
3738
delay(10); // Arduino needs a moment to setup serial
3839
Serial7Segment.write(0x81); // Send factory reset command
3940
}
40-
41+
4142
Serial7Segment.begin(9600);
4243
delay(10); // Arduino needs a moment to setup serial
43-
Serial7Segment.write(0x76); // Clear the display
44-
Serial7Segment.write('t');
45-
Serial7Segment.write('e');
46-
Serial7Segment.write('s');
47-
Serial7Segment.write('t');
44+
Serial7Segment.print("0000"); //Send some characters out .print to clear out the buffer
45+
Serial7Segment.write('v'); //Reset the display - this forces the cursor to return to the beginning of the display
46+
Serial7Segment.print("test"); //Display a test message on the screen
4847

4948
Serial.println("Attempt is now done. If the display says 'test', it has been reset to 9600bps");
5049
}

firmware/Serial 7-Segment Display/Serial_7_Segment_Display_Firmware/Serial_7_Segment_Display_Firmware.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ SevSeg myDisplay; //Create an instance of the object
3535
//OpenSegment uses PNP and NPN transistors to drive larger displays
3636
#define S7S 1
3737
#define OPENSEGMENT 2
38-
#define DISPLAY_TYPE S7S
38+
#define DISPLAY_TYPE OPENSEGMENT
3939

4040
// Struct for circular data buffer data received over UART, SPI and I2C are all sent into a single buffer
4141
struct dataBuffer

0 commit comments

Comments
 (0)