This logic can then be plugged into the temperature sketch discussed in the previous post.
Turns out that using SoftwareSerial, you can chat with the sparkfun Serial 7-Segment display quite easily:
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
#include <SoftwareSerial.h> | |
SoftwareSerial mySerial(2, 3); // Pin 3 on arduino to RX on 7-seg | |
void setup(){ | |
mySerial.begin(2400); // Setup connection at baud rate 2400 (some may be default 9600) | |
delay(50); | |
mySerial.write(0x77); // Clear all decimal points | |
mySerial.write((uint8_t)0x00); //write a 0x00 (without uint8_t an error is thrown) | |
mySerial.write(0x7A); // Brightness 00 is brightest | |
mySerial.write((uint8_t)0x00); | |
mySerial.print("v"); // Reset current display | |
} | |
void loop(void) | |
{ | |
mySerial.print("1234"); // Show 1234 | |
} |
Please note - as mentioned the display comes with a default 9600 baud rate. Mine got re-programmed due to a lack of pull down resistors (as discussed on the sparkfun product pages)!
Also note, many of the strange 'hex commands' send to the 7-Seg display were drawn from the data sheet. Reference it before doing any additional programming here (sparkfun user's manual).
No comments:
Post a Comment