-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
basic display driver #21
Comments
Thanks for reaching out. The specific issue you are commenting on here is unclear. If you have found a specific bug in our code, please let us know. Otherwise, if you are simply looking to modify the code for your personal project, we have an example sketch for changing the SPI settings here. |
thanks for the reply. when I used ProMini's the example code worked well.
this was like 5 years ago. Now I only use Teency's and the example code
mostly does not work. the new GitHub SPI Bus code for the displays from:
https://github.com/sparkfun/Serial7SegmentDisplay don't have chip and stuff
for example, the folloning code is not helpull in getting basic display
operation S7S_EcampleSerial_Basic: ( I would like to display{-12.3}
/*
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.
Note: This code expects the display to be listening at 9600bps. If your
display is not at 9600bps, you can
do a software or hardware reset. See the Wiki for more info:
http://github.com/sparkfun/Serial7SegmentDisplay/wiki/Special-Commands#wiki-baud
To get this code to work, attached an Serial7Segment to an Arduino Uno
using the following pins:
Pin 8 on Uno (software serial TX) 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
Serial7Segment.write('v'); //Reset the display - this forces the cursor
to return to the beginning of the display
}
void loop()
{
cycles++; //Counting cycles! Yay!
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
//Note: This method works well as long as your number is less than or
equal to 4 digits.
//14422 will cause the display to wrap (5 digits)
//-5766 will cause the display to wrap (5 digits)
//To fix this, send a 'v' character or look at how to control the digit
placement
//
https://github.com/sparkfun/Serial7SegmentDisplay/wiki/Basic-Usage#wiki-cursor
Serial7Segment.print(tempString); //Send serial string out the soft
serial port to the S7S
delay(10);
}
…On Thu, Feb 9, 2017 at 2:13 PM, Brent Wilkins ***@***.***> wrote:
Thanks for reaching out. The specific issue you are commenting on here is
unclear. If you have found a specific bug in our code, please let us know.
Otherwise, if you are simply looking to modify the code for your personal
project, we have an example sketch for changing the SPI settings here
<https://github.com/sparkfun/Serial7SegmentDisplay/blob/master/firmware/Serial%207-Segment%20Display/Arduino_Examples/S7S_Example_SPI_Settings/S7S_Example_SPI_Settings.ino>
.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#21 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AYOmc4us8PORerTsxaz6-3B8G_cqKDbGks5ra2VcgaJpZM4L8U79>
.
|
I wasn't able to reproduce any issues with the code found in S7S_Example_Serial_Basic on a Teensy. I wired up the TX line on the Teensy (8) to the RX line in the display module. To display your example of "-12.3" I replaced the contents of // Writing 4 digits each time. In this case no need to clear display.
Serial7Segment.print("-123");
Serial7Segment.write(0x77); // Decimal control command
Serial7Segment.write(0b00000100); // Turns on tenths decimal In other cases you might want to send the reset command (RESET_CMD | 0x76 | 'v') first. This might be If you want to modify the firmware to handle numbers rather than ASCII characters and commands, take a look at the Do you have our SevSeg library installed? If you have the original library that we forked, not ours, you will get errors such as |
could you send the entire code please. This code is SPI not I2C, right?
…On Tue, Feb 14, 2017 at 4:20 PM, Brent Wilkins ***@***.***> wrote:
I wasn't able to reproduce any issues with the code found in
S7S_Example_Serial_Basic on a Teensy. I wired up the TX line on the Teensy
(8) to the RX line in the display module. To display your example of
"-12.3" I replaced the contents of loop() with the following code:
// Writing 4 digits each time. In this case no need to clear display.
Serial7Segment.print("-123");
Serial7Segment.write(0x77); // Decimal control command
Serial7Segment.write(0b00000100); // Turns on tenths decimal
In other cases you might want to send the reset command (RESET_CMD | 0x76
| 'v') first. This might be Serial7Segment.print("v-123"); for this case.
If you want to modify the firmware to handle numbers rather than ASCII
characters and commands, take a look at the void
SevSeg::DisplayString(const char*, byte) method found here
<https://github.com/sparkfun/SevSeg/blob/master/src/SevSeg.cpp>. I
replaced line 114 in the firmware
<https://github.com/sparkfun/Serial7SegmentDisplay/blob/master/firmware/Serial%207-Segment%20Display/Serial_7_Segment_Display_Firmware/Serial_7_Segment_Display_Firmware.ino>
myDisplay.DisplayString(display.digits, display.decimals); with
myDisplay.DisplayString("-123", 4); to display -12.3.
Do you have our SevSeg library installed? If you have the original library
that we forked, not ours, you will get errors such as error: 'class
SevSeg' has no member named 'DisplayString'.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#21 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AYOmc-lrQodUAynRQU2MSrvXaL77eZQtks5rchqzgaJpZM4L8U79>
.
|
Here is the entire sketch minus the copyright and such in the header. #include <SoftwareSerial.h>
SoftwareSerial Serial7Segment(7, 8); //RX pin, TX pin
int cycles = 0;
void setup() {
Serial.begin(9600);
delay(4000);
Serial.println("OpenSegment Example Code");
Serial7Segment.begin(9600); //Talk to the Serial7Segment at 9600 bps
Serial7Segment.write('v'); //Reset the display - this forces the cursor to return to the beginning of the display
}
void loop()
{
Serial.println("Displaying: -12.3");
// Writing 4 digits each time. In this case no need to clear display.
Serial7Segment.print("-123");
Serial7Segment.write(0x77); // Decimal control command
Serial7Segment.write(0b00000100); // Turns on tenths decimal
} The first line includes the file with the software UART implementation. The next line of code creates an instance of the SoftwareSerial class named |
I need to display temperatures from -99.9 to 99.9 (with the leading digit blanked when the value is positive.
I will be driving 10 serial displays and I need to assign the CS pin.
The text was updated successfully, but these errors were encountered: