Coder Social home page Coder Social logo

ledcontrol's Introduction

ledcontrol's People

Contributors

matthijskooijman avatar wayoda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ledcontrol's Issues

Doesnt work with esp8266 based boards

In file included from C:\Users\richard\Documents\Arduino\libraries\LedControl\src\LedControl.cpp:28:0:
C:\Users\richard\Documents\Arduino\libraries\LedControl\src\LedControl.h:30:26: fatal error: avr/pgmspace.h: No such file or directory
#include <avr/pgmspace.h>
^
compilation terminated.
Error compiling.

Timing Problem for Max7219

I have an timing Problem with Max7219, sending data to Matrix not always works, sometimes it hangs only reset will leave this state.
In the datasheet there is a Data-to-Segment Delay from max. 2.25ms

My Solution:
i changed spiTransfer function before leaving the function

void LedControl::spiTransfer(int addr, volatile byte opcode, volatile byte data) {
:
:
digitalWrite(SPI_CS,HIGH);
delayMicroseconds(3000); //Datasheet MAX7219 min 2,2ms <====
}
with this change it works perfect

Performance improvements with use of SPI API

Hi, I have changed just 2 rows of the LedControl.cpp so that the library can use the SPI protocol.
I added

  1. #include <SPI.h> as the first row,
  2. SPI.transfer(spidata[i-1]); at row 206 instead of shiftOut(SPI_MOSI,SPI_CLK,MSBFIRST,spidata[i-1]);

With this simple changes now I'm able to show a message with an high scrolling rate (depending also on how you initialize the SPI interface).
This is the initialization chunk in the setup() function:

...
SPISettings settingsA(8000000, MSBFIRST, SPI_MODE0);

void setup() {
// initialize SPI:
SPI.begin();
SPI.beginTransaction(settingsA);
...
}

dsc_8394
dsc_8401

Minor test issues in setScanLimit() and setIntensity() methods

I’ve spotted a couple of minor issues with the setScanLimit() and setIntensity() methods. The test ‘limit>=0 || limit<8’ on line 88 is always true, so spiTransfer is called even with bad limit values. Line 88 should be corrected as shown below:

if(limit>=0 && limit<8)

Similarly, on line 95 there is a test ‘intensity>=0 || intensity<16’ which is always true no matter what. Line 95 should be corrected as shown below:

if(intensity>=0 && intensity<16)

Request the addition of 5 new characters

I would like to use 7-segment displays as part of a Heads up display, this will require that their reflections in a vehicle windscreen are readable. To achieve this, each number needs to be reflected about its vertical axis to produce a reversed character. This can already be achieved for 5 numbers -
8 and 0 reflect themselves
2 reflects as 5
5 reflects as 2
3 reflects as E
However, for the remaining 5 digits, new characters are needed, with the following segments lit -
1 - E & F
4 - B,E,F & G
6 - All but F
7 - A,E and F
9 - All but C

Would this be possible please?

Questions about the failure of finding Aduino files

I am an inking. I was lucky to learn Aduino, but I failed to find the file. I downloaded all versions but failed. I want to know why. I downloaded version 1.0.7 and I wrote down the aduino code and pressed OK, but the file cannot be found.

Ledcontrol and w5100 unit not working together

Trying to compile a project with following liberys

`#include <SPI.h>

include <Ethernet.h>

include <ICMPPing.h>

include <OneWire.h>

include <DallasTemperature.h>

include <LedControl.h> `

Gives the following error In file included from D:\Dropbox\KG\Personligt\Arduino\libraries\icmp_ping/ICMPPing.h:12:0, from Bastucontroller.ino:4: C:\Program Files (x86)\arduino-1.6.5-r2\libraries\Ethernet\src/utility/w5100.h:15:16: error: expected unqualified-id before numeric constant #define SPI_CS 10 ^ D:\Dropbox\KG\Personligt\Arduino\libraries\LedControl\src/LedControl.h:75:13: note: in expansion of macro 'SPI_CS' int SPI_CS; ^ Error compiling.

Only thing that works is to comment out ledcontroll, then it compiles.

Bug in function setLed()

You can set only one LED in the same row. If you set another LED in the same row the other turns off!

printNumber(int v) function in the examples

Must assign "false" to the boolean variable "negative" up front. If not, it defaults to "true" and all the displays will be negative. Also, don't need to multiply v=v* -1; It doesn't matter, since you are building the answer one digit at a time separately, and the sign digit is assigned regardless of this statement.

setColumn function seems to use Arduino pin 2?

I am using a Teensy LC, connecting 2 5X8 LED matrixes with 2 daisy chained MAX 2719s, using pins 10,11,12 for the chips, but also have a 7-seg display connected to free pins including 0-9, and 18,19. All is good until I call lc.setColumn() and it seems to set pin 2 LOW, turning off that segment on the 7-seg display. Note the 7-seg is not using a MAX 2719, just all pins directly to Teensy pins.
Is setColumn somehow using pin 2?

more the 8 daisy chained

I would like to "daisychain" 10 7219 chips using ledcontrol.h but I am only successful with 8. Is this a software issue or a chip issue? Thanks

My float sketch - as a demo for other's to adapt to whatever as they please...

Thank you for your LedControl library. Works pretty well, but could use some more demo sketches to help newbies understand how to use the library in their sketches. So, here's my sketch that displays floating point numbers on 8-digit 7-segment displays using your LedControl library.

`// //////////////////////////////////////////////////////////////////////////////////////////////////
//
// This sketch is designed to output a floating point number to an 8-digit, 7-segment LED display
// using the LedControl library and a float-to-string conversion function called dtostrf().
//
// The displayed numbers are often off a tad... digit 0 is off, probably some kind of rounding error
// associated with dtostrf().
//
// ///////////////////////////////////////////////////////////////////////////////////////////////////

include<stdlib.h> // For dtostrf(), a float-to-string conversion function

include "LedControl.h" // We need to use the LedControl library to create a object...

LedControl lc=LedControl(12,11,10,1); // "lc" is the name of our object
// pin 12 is connected to the MAX7219 pin 1
// pin 11 is connected to the CLK pin 13
// pin 10 is connected to LOAD pin 12
// 1 as we are only using 1 MAX7219

// Some randomly generated test numbers:
//float f_val = 85288.039; // correct
//float f_val = 4355.7391; // very close, digit 0 was "3". Off by 2.
//float f_val = 78.737960; // very close, digit 0 was "1". Off by 1.
//float f_val = 633.04075; // very close, digit 0 was "7". Off by 2.
//float f_val = 406719.39; // very close, digit 0 was "8". Off by 1.
//float f_val = 9027.9018; // very close, digit 0 was "4". Off by 4!
//float f_val = 3.4024752; // very close, digit 0 was "1". Off by 1.
//float f_val = 0.4413655; // correct
//float f_val = 206947.90; // very close, digit 0 was "1". Off by 1.
//float f_val = 18573226; // correct
//float f_val = 0.0; // showed 0.0000000 (would be nice if showed 0.0 with leading zeros blanked out).
float f_val = 212.4999999; // showed 212.50000. Likely a rounding error.

static char outputBuffer[20]; // outputBuffer[] likely 2x the size it needs to be.

void setup() {

// The first argument ("0") refers to the MAX7219 number, it is zero for 1 chip
lc.shutdown(0,false); // turn off power saving, enables display
lc.setIntensity(0,5); // sets brightness (0~15 possible values)
lc.clearDisplay(0); // clear screen

dtostrf(f_val,7, 7, outputBuffer);

Serial.begin(9600);
Serial.println("\n====Reset====");

printBuffer(outputBuffer);

}

void printBuffer(char *outputBuffer) {

int fudgeridoo=7;

for(int i=0; i<9; i++) {
Serial.print(outputBuffer[i]);
if (outputBuffer[i] == '.') {
i--;
lc.setChar(0,fudgeridoo-i,outputBuffer[i],1);
i++; fudgeridoo++;
} else {
lc.setChar(0,fudgeridoo-i,outputBuffer[i],0);
}
}
}

void loop() {
// Nothing happening here.
}
`

Enjoy...

-Wm. Moore

Delete segment

I use setDigit() to write a character on a 7 seg. How to delete that character, so nothing is displayed? Not to write 0, but to print nothing?

LedControl.h:54: error: 'byte' has not been declared

Hello, I'm trying to use the library, with a arduino duemilanove and Arduino IDE 1.0.5 under mac 10.9.4.
When I compile any DEMO i get the following error:
/Applications/Arduino.app/Contents/Resources/Java/libraries/LedControl/LedControl.h:54: error: 'byte' does not name a type

I don't know which is the problem, please can you help me?

Best regards.

Documentation error "Control the column of a matrix"

The "Control the column of a matrix" section seems incorrect to me.
Looks like part of the "Control the row of a matrix" section was copied.

Current:

//Setting the leds from the third row (index=2) of the first device 
lc.setRow(0,2,B00001111); 

Should be:

//Setting the leds from the sixth column (index=5) of the first device 
lc.setColumn(0,5,B00001111); 

The table now says:

Led On	Yes	No	Yes	Yes	No	No	No	No

but should be:

Led On	No	No	No	No	Yes	Yes	Yes	Yes

Still maintened ?

Hello Wayoda
Thanks for the great job. Ledcontrol library is incredibly useful (and I do love LED displays).
Is the library still maintened ?
I notice that interesting commits didn't received an answer since a long time.
All the best.

MAX7219 not working with ESP32 anymore

The MAX7219 is not working together with my NodeMCU ESP32-S anymore. It did around a half year ago, but then I stopped programming with the LED Matrix.
When I upload a sketch it lights up all four or three out of four segments fully up (every pixel is bright doesn't matter what I've programmed), but when I plug it into my computer nothing happens.

I tried both ways of installing the Arduino Core (Board Manager and Windows) and made the avr/pgmspace.h fix.
Does anyone have the same problem?

Thank you in advance

Lights not changing

I have setup the dot matrix but when I run any of the demo programs or any of my own the lights never change. is this an issue with the library or my matrix/setup?

LedControl.h Compile error using Arduino Giga R1

I used LCDemoMatrix.ino example which works great on a Mega 2560, but the project I'm working on uses the Giga R1, but when I try to compile the same sketch on the R1, I get errors on expansion of macro SPI_MOSI
see end for copy of error message.
I created a totally blank sketch containing only the following:

#include "LedControl.h" 
void setup(){ 
} 
void loop(){
}

even tried the <> round the LedControl.h and including Arduino.h into the LedControl.h file (as this seems to fix other issues in the past) but whatever I've tried it still returns the same error on compiling.

Is there anything I can try to rectify this ?
I'm assuming it down to the Giga being MBed so maybe the files need updating so this will work with the Giga.

Hoping you can help with this

Chris

ERROR MESSAGE
In file included from /Library/Arduino15/packages/arduino/hardware/mbed_giga/4.1.1/cores/arduino/Arduino.h:76:0,vfrom /private/var/folders/tb/rs678pkd0vj60ndbmk3l1b800000gn/T/arduino/sketches/3C0EF7E69088BCAD6968DD946D6405E4/sketch/sketch_apr7b.ino.cpp:1:
/Library/Arduino15/packages/arduino/hardware/mbed_giga/4.1.1/variants/GIGA/pins_arduino.h:175:23: error: expected identifier before '(' token
#define PIN_SPI_MOSI (90u)
^
/Library/Arduino15/packages/arduino/hardware/mbed_giga/4.1.1/variants/GIGA/pins_arduino.h:243:41: note: in expansion of macro 'PIN_SPI_MOSI'
#define SPI_MOSI (digitalPinToPinName(PIN_SPI_MOSI))
^~~~~~~~~~~~
/Documents/Arduino/libraries/LedControl/src/LedControl.h:72:13: note: in expansion of macro 'SPI_MOSI'
int SPI_MOSI;
^
/Library/Arduino15/packages/arduino/hardware/mbed_giga/4.1.1/variants/GIGA/pins_arduino.h:175:24: error: expected ')' before numeric constant
#define PIN_SPI_MOSI (90u)
^
/Library/Arduino15/packages/arduino/hardware/mbed_giga/4.1.1/variants/GIGA/pins_arduino.h:175:24: note: in definition of macro 'PIN_SPI_MOSI'
#define PIN_SPI_MOSI (90u)
^~~
/Documents/Arduino/libraries/LedControl/src/LedControl.h:72:13: note: in expansion of macro 'SPI_MOSI'
int SPI_MOSI;
^
/Library/Arduino15/packages/arduino/hardware/mbed_giga/4.1.1/variants/GIGA/pins_arduino.h:175:24: error: expected ')' before numeric constant
#define PIN_SPI_MOSI (90u)
^
/Library/Arduino15/packages/arduino/hardware/mbed_giga/4.1.1/variants/GIGA/pins_arduino.h:175:24: note: in definition of macro 'PIN_SPI_MOSI'
#define PIN_SPI_MOSI (90u)
^~~
/Documents/Arduino/libraries/LedControl/src/LedControl.h:72:13: note: in expansion of macro 'SPI_MOSI'
int SPI_MOSI;
^
/Library/Arduino15/packages/arduino/hardware/mbed_giga/4.1.1/variants/GIGA/pins_arduino.h:175:24: error: expected ')' before numeric constant
#define PIN_SPI_MOSI (90u)
^
/Library/Arduino15/packages/arduino/hardware/mbed_giga/4.1.1/variants/GIGA/pins_arduino.h:175:24: note: in definition of macro 'PIN_SPI_MOSI'
#define PIN_SPI_MOSI (90u)
^~~
/Documents/Arduino/libraries/LedControl/src/LedControl.h:72:13: note: in expansion of macro 'SPI_MOSI'
int SPI_MOSI;
^

exit status 1

Compilation error: exit status 1

Easiest way to display a number?

Hey guys, if I have an integer something like 62581.... Is there an easy way to get it displayed on an 8 digit 7 segment setup?

Do I have to split it up into the individual numbers or is there some trick I can do? I've seen some code snippets that divide by stuff and break it into 8 digits but I'm not sure how I'd ignore leading zeros and not end up with displaying 00062581....

Any help would be appreciated.

Tommy

LED Matrix Scroll Text Marquee?

I was thinking about using a 5x5 led matrix and the LEDControl library for one of my projects. I need it to scroll text, and I need it to display text. Any ideas? I really need it done soon.

Show uppercase 'C' for temperature - workaround here

For unknown reasons the library converts uppercase 'C' to lowercase 'c' if you use setChar. You may want to use uppercase one, most likely for temperature display but not only for that. As library seems to be unmaintained now I'm publishing a workaround in "Issues".

In that case, open LedControl.h and replace PROGMEM with this
const static byte charTable [] PROGMEM = { B01111110,B00110000,B01101101,B01111001,B00110011,B01011011,B01011111,B01110000, B01111111,B01111011,B01110111,B00011111,B00001101,B00111101,B01001111,B01000111, B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, B00000000,B00000000,B00000000,B00000000,B10000000,B00000001,B10000000,B00000000, B01111110,B00110000,B01101101,B01111001,B00110011,B01011011,B01011111,B01110000, B01111111,B01111011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, B00000000,B01110111,B00011111,B01001110,B00111101,B01001111,B01000111,B00000000, B00110111,B00000000,B00000000,B00000000,B00001110,B00000000,B00000000,B00000000, B01100111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001000, B00000000,B01110111,B00011111,B00001101,B00111101,B01001111,B01000111,B00000000, B00110111,B00000000,B00000000,B00000000,B00001110,B00000000,B00010101,B00011101, B01100111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000 };

You can modify this array to make library show other characters if you wish, binary data is as following:

1st bit - Decimal point
rest of bits - binary segment data representation on standard 7 seg display. Look in the internet for scheme

Regards,
Daniel

LedControl onlu starts after Reset

In my project (imer for my enlarger) I use a MAX7219 controled through the LedControl library. In the sketch setup I have the follwing Lines:
lc.shutdown(0,false);
lc.setIntensity(0,10);
lc.clearDisplay(0);
DspLeft(Char_E, Char_Bl, Char_Bl);
The last line calls a subroutine to display certain characters in the display.
On startup the display remains blank (no sign) however. Only after I called a Reset routine it shows the required characters:
lc.shutdown(0,false);
lc.setIntensity(0,10);
lc.clearDisplay(0);
DspLeft(Char_E, Char_Bl, Char_Bl);

upper case 'C' is displayed as lower case 'c'

The upper case 'C' is actually a lower case 'c'. The following changes to LedControl.h fix this issue:

  • B00000000,B01110111,B00011111,B00001101,B00111101,B01001111,B01000111,B00000000,
  • B00000000,B01110111,B00011111,B01001110,B00111101,B01001111,B01000111,B00000000,

image is mirrored on matrix

i've tested your library on a max7219cgn controlled matrix 8x8.the "images" were mirrored on the matrix.for example "d" was "b".i've modified the library a little and now works like a charm :)

i've modified the spiTransfer from LedControl,bot setRow and setLed

i've added "7-row+1" to make it look normal

Function to print char array

I don't know how to add this function to your useful library.
This is what I wrote to print a char[] array to 7segment module:

void SEVSEG_PRINT(uint8_t arg1_ID, char arg2_DATA[]) {

      uint8_t tmp_LOCATION = 0;
      bool tmp_HAS_POINT = false;

      SEVSEG_MODULE.clearDisplay(arg1_ID);
      for (uint8_t i = 0; i < strlen(arg2_DATA); i++) {
        char tmp_CHAR = arg2_DATA[strlen(arg2_DATA) - i - 1];
        char tmp_CHAR_NEXT = arg2_DATA[strlen(arg2_DATA) - i - 2];
        if (tmp_CHAR == '.') {
          if (tmp_CHAR_NEXT == '.') {
            SEVSEG_MODULE.setChar(arg1_ID, tmp_LOCATION, '.', tmp_HAS_POINT);
            tmp_LOCATION++;
            tmp_HAS_POINT = false;
          } else {
            tmp_HAS_POINT = true;
          }
        } else if (isalpha(tmp_CHAR) || tmp_CHAR == ' ') {
          SEVSEG_MODULE.setChar(arg1_ID, tmp_LOCATION, tmp_CHAR, tmp_HAS_POINT);
          tmp_LOCATION++;
          tmp_HAS_POINT = false;
        } else if (isdigit(tmp_CHAR)) {
          SEVSEG_MODULE.setDigit(arg1_ID, tmp_LOCATION, tmp_CHAR - '0', tmp_HAS_POINT);
          tmp_LOCATION++;
          tmp_HAS_POINT = false;
        }
      }
}

I hope it helps!
Try calling SEVSEG_PRINT(0, 'Hello ...');

Unused variable in setChar function

This issue was was reported by mail :


Hi,

In LedControl::setChar, I think the following is incorrect:

    index=(byte)value;
    if(index >127) {
    //nothing define we use the space char
    value=32;
    }
    v=charTable[index];

Shouldn't it be:

    index=(byte)value;
    if(index >127) {
    //nothing define we use the space char
    index =32;
    }
    v=charTable[index];

Since 'value' is not used anywhere else!

Cheers,
Zheng

Logic needs timing control on fast processors ...

We have a project underway to run Sketches written for Arduinos on the Raspberry Pi. With its GHz processor, it is 50x faster than the Arduino. This is causing problems with the library which is bit banging SPI because the timings of the bits now become 50x faster. Obviously the library is perfect for real arduinos but we might want to address the notion that CPU speeds will get faster and logic may break. For example, I believe that max clock for the 7219 is 10MHz ... but at 1GHz ... processor speeds and bit banging ... the time which a signal is high or low may be too short without some timing logic built in or hardware SPI timing controls.

Feed from each led

A feedback from each Led to know the state of each LED whether HIGH/LOW, it would be helpful especially while designing games.

Request the addition of 3 new characters

Could you please add inverted 4, inverted 6, inverted 7 and inverted 9 to the character list - this would then allow a complete inverted number display for use in head-up displays, where the LED numbers are reflected off the vehicle windscreen.

At present, 1 inverts to itself, 2 inverts to 5, 3 inverts to itself, 5 inverts to 2, 8 inverts to itself, and 0 inverts to itself, so you can see what's missing.

For inverted 4, light segments B,C,E & G
For inverted 6, light segments A,B,D,E,F & G
For inverted 7, light segments B,C & D
For inverted 9, light segments A,B,C,D,E & G

TIA

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.