Skip to content
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

Open
Dc2LightTech opened this issue Feb 9, 2017 · 5 comments
Open

basic display driver #21

Dc2LightTech opened this issue Feb 9, 2017 · 5 comments
Assignees

Comments

@Dc2LightTech
Copy link

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.

@BrentWilkins
Copy link

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.

@Dc2LightTech
Copy link
Author

Dc2LightTech commented Feb 9, 2017 via email

@BrentWilkins
Copy link

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. I replaced line 114 in the firmware 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'.

@Dc2LightTech
Copy link
Author

Dc2LightTech commented Feb 15, 2017 via email

@BrentWilkins
Copy link

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 Serial7Segment that uses pins 7 & 8.
If you want to use SPI instead, I recommend looking at our SPI example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants