Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reverting to the latest working version
All commits after this use the SevSeg library to control the display and do not work with the display at the moment. As these displays are beginning to go live, I'd like a working version only of the code to be hosted here.
- Loading branch information
Jim Lindblom
committed
Oct 31, 2012
1 parent
04a9283
commit 517d2f2
Showing
7 changed files
with
523 additions
and
597 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
55 changes: 55 additions & 0 deletions
55
...al 7-Segment Display/Arduino_Examples/S7S_Example_BasicSerial/S7S_Example_BasicSerial.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
9-23-2012 | ||
Spark Fun Electronics | ||
Nathan Seidle | ||
This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license). | ||
Serial7Segment is an open source seven segment display. | ||
This is example code that shows how to display basic numbers on the display. | ||
To get this code to work, attached an Serial7Segment to an Arduino Uno using the following pins: | ||
Pin 7 on Uno (software serial RX) to TX on Serial7Segment | ||
Pin 8 on Uno to RX on Serial7Segment | ||
VIN to PWR | ||
GND to GND | ||
*/ | ||
|
||
#include <SoftwareSerial.h> | ||
|
||
SoftwareSerial Serial7Segment(7, 8); //RX pin, TX pin | ||
|
||
int cycles = 0; | ||
|
||
void setup() { | ||
|
||
Serial.begin(9600); | ||
Serial.println("OpenSegment Example Code"); | ||
|
||
Serial7Segment.begin(9600); //Talk to the Serial7Segment at 9600 bps | ||
|
||
//Reset the display | ||
Serial7Segment.write('v'); //This forces the cursor to return to the beginning of the display | ||
} | ||
|
||
void loop() { | ||
Serial.print("Cycle: "); | ||
Serial.println(cycles++); | ||
|
||
char tempString[10]; //Used for sprintf | ||
sprintf(tempString, "%4d", cycles); //Convert deciSecond into a string that is right adjusted | ||
//sprintf(tempString, "%d", cycles); //Convert deciSecond into a string that is left adjusted (requires digit 1 command) | ||
//sprintf(tempString, "%04d", cycles); //Convert deciSecond into a string with leading zeros | ||
//sprintf(tempString, "%4X", cycles); //Count in HEX, right adjusted | ||
//int negativeCycles = cycles * -1; | ||
//sprintf(tempString, "%4d", negativeCycles); //Shows a negative sign infront of right adjusted number | ||
|
||
Serial7Segment.print(tempString); | ||
|
||
// delay(1); | ||
} | ||
|
||
|
||
|
Oops, something went wrong.