Permalink
Browse files

Improved the software reset sketch. Uses strings now.

  • Loading branch information...
nseidle committed Nov 5, 2012
1 parent 55c028d commit 9f94cb6e5160b1d95e181f0925b97496670f112a
@@ -10,6 +10,8 @@
Did you set your Serial7Segment display to a baud rate you don't know? This example sketch
should get you fixed up! This example code sends the factory reset command at 12 different baud rates.
For more information see: http://github.com/sparkfun/Serial7SegmentDisplay/wiki/Special-Commands#wiki-reset
To get this code to work, attached an Serial7Segment to an Arduino Uno using the following pins:
Pin 8 on Uno to RX on Serial7Segment
VIN to PWR
@@ -29,22 +31,19 @@ void setup()
Serial.println("Attempting to reset display to 9600bps...");
//Step through each available serial baud rate and send the factory reset command
int baudRates[12] = {2400, 4800, 9600, 14400, 19200, 38400,
57600, 7600, 115200, 250000, 500000, 1000000};
int baudRates[12] = {2400, 4800, 9600, 14400, 19200, 38400, 57600, 7600, 115200, 250000, 500000, 1000000};
for (int i = 0 ; i < 12 ; i++)
{
Serial7Segment.begin(baudRates[i]); // Set new baud rate
delay(10); // Arduino needs a moment to setup serial
Serial7Segment.write(0x81); // Send factory reset command
}
Serial7Segment.begin(9600);
delay(10); // Arduino needs a moment to setup serial
Serial7Segment.write(0x76); // Clear the display
Serial7Segment.write('t');
Serial7Segment.write('e');
Serial7Segment.write('s');
Serial7Segment.write('t');
Serial7Segment.print("0000"); //Send some characters out .print to clear out the buffer
Serial7Segment.write('v'); //Reset the display - this forces the cursor to return to the beginning of the display
Serial7Segment.print("test"); //Display a test message on the screen
Serial.println("Attempt is now done. If the display says 'test', it has been reset to 9600bps");
}
@@ -35,7 +35,7 @@ SevSeg myDisplay; //Create an instance of the object
//OpenSegment uses PNP and NPN transistors to drive larger displays
#define S7S 1
#define OPENSEGMENT 2
#define DISPLAY_TYPE S7S
#define DISPLAY_TYPE OPENSEGMENT
// Struct for circular data buffer data received over UART, SPI and I2C are all sent into a single buffer
struct dataBuffer

0 comments on commit 9f94cb6

Please sign in to comment.