Skip to content

Commit 5970b68

Browse files
committed
Completed multimode support.
Works well. Split the bulkier system functions into their own file. This made room for the mode runctions in the main file.
1 parent cb5be47 commit 5970b68

File tree

3 files changed

+517
-428
lines changed

3 files changed

+517
-428
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
11-24-2012
3+
Spark Fun Electronics
4+
Nathan Seidle
5+
6+
This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license).
7+
8+
Serial7Segment is an open source seven segment display.
9+
10+
This is example code puts the display into counter mode.
11+
12+
Note: This code expects the display to be listening at 9600bps. If your display is not at 9600bps, you can
13+
do a software or hardware reset. See the Wiki for more info:
14+
http://github.com/sparkfun/Serial7SegmentDisplay/wiki/Special-Commands#wiki-baud
15+
16+
To get this code to work, attached an Serial7Segment to an Arduino Uno using the following pins:
17+
Pin 8 on Uno (software serial TX) to RX on Serial7Segment
18+
VIN to PWR
19+
GND to GND
20+
Button on SDI (Increment)
21+
Button on SDO (Decrement)
22+
23+
*/
24+
25+
#include <SoftwareSerial.h>
26+
27+
SoftwareSerial Serial7Segment(7, 8); //RX pin, TX pin
28+
29+
#define MODE_CMD 0x82
30+
31+
#define MODE_DATA 0
32+
#define MODE_ANALOG 1
33+
#define MODE_COUNTER 2
34+
35+
int cycles = 0;
36+
37+
void setup() {
38+
39+
Serial.begin(9600);
40+
Serial.println("OpenSegment Example Code");
41+
42+
Serial7Segment.begin(9600); //Talk to the Serial7Segment at 9600 bps
43+
Serial7Segment.write('v'); //Reset the display - this forces the cursor to return to the beginning of the display
44+
45+
delay(10);
46+
Serial7Segment.write(MODE_CMD); //Change the mode of the display
47+
Serial7Segment.write(MODE_COUNTER); //Enter counter mode. Any pulse on SDI will go up. Any pulse on SDO will go down.
48+
// Serial7Segment.write(MODE_ANALOG); //Enter analog mode. Unit will display the analog voltages detected on A6/A7.
49+
// Serial7Segment.write(MODE_DATA); //Return to normal mode. You can also do a hardware reset to return to normal data mode.
50+
51+
}
52+
53+
void loop()
54+
{
55+
//Do nothing. User must hit momentary buttons connected to SDI/SDO
56+
}
57+
58+
59+

0 commit comments

Comments
 (0)