Giter Site home page Giter Site logo

dmd's Introduction

DMD library
--------------
Marc Alexander, Freetronics
Email: info (at) freetronics.com
URL:   http://www.freetronics.com/dmd-library

A library for driving the Freetronics 512 pixel dot matrix LED display "DMD", a 32 x 16 layout.

Includes:
- High speed display connection straight to SPI port and pins.
- A full 5 x 7 pixel font set and character routines for display.
- A numerical and symbol 6 x 16 font set with a colon especially for clocks and other fun large displays.
- Special graphics modes: Normal, Inverse, Toggle, OR and NOR!
- Clear screen with all pixels off or on.
- Point to point line drawing.
- Circle drawing.
- Box (rectangle) drawing, border and filled versions.
- Test pattern generation.

For the DMD panel see: http://www.freetronics.com/dmd

USAGE NOTES
-----------

- Place the DMD library folder into the "arduino/libraries/" folder of your Arduino installation.
- Get the TimerOne library from here: http://code.google.com/p/arduino-timerone/downloads/list
  or download the local copy from the DMD library page (which may be older but was used for this creation)
  and place the TimerOne library folder into the "arduino/libraries/" folder of your Arduino installation.
- Restart the IDE.
- In the Arduino IDE, you can open File > Examples > DMD > dmd_demo, or dmd_clock_readout, and get it
  running straight away!

* The DMD comes with a pre-made data cable and DMDCON connector board so you can plug-and-play straight
  into any regular size Arduino Board (Uno, Freetronics Eleven, EtherTen, USBDroid, etc)
  
* Please note that the Mega boards have SPI on different pins, so this library does not currently support
  the DMDCON connector board for direct connection to Mega's, please jumper the DMDCON pins to the
  matching SPI pins on the other header on the Mega boards.

PROJECT HOME
------------

http://www.freetronics.com/dmd-library

dmd's People

Contributors

cjd avatar jonoxer avatar projectgus avatar xseignard 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

dmd's Issues

Play different Animations at a time - DMD P10

Need an urgent help -
I am using 4 number of 16x32 P10 LED in a combination of 32x64 - 2 Row and 2 Column.

I need to display different animations on each row. Example - 1st row should display the sliding text and 2nd row should perform the flashing text.

However, I am able to play the animation at one row keeping 2nd row animation static. Can anybody please let me know how we can achieve it to play the animations on both rows?

Below is the code that I am using -

  dmd.drawString(event_len1,17,"Hello",strlen("Hello"),GRAPHICS_NORMAL); // the stationary string
  dmd.drawString(event_len2,25,"World",strlen("World"),GRAPHICS_NORMAL); // the stationary string

  dmd.drawMarquee("CODE BLINKING!",strlen("CODE BLINKING!"),0, 4); // set up the marquee
  time = millis();
  n=0;
  while(n<3) {
    while (!ret) {
      if ((time+20) < millis()) {
        ret = dmd.stepSplitMarquee(0,16); // parameters are the top & bottom rows to be scrolled
        time = millis();
      }
    }
    ret = false;
    n++;
  }
  dmd.clearScreen( true );

  dmd.drawString(name_len1,1,"HELLO",strlen("HELLO"),GRAPHICS_NORMAL); // the stationary string
  dmd.drawString(name_len2,9,"WORLD!",strlen("WORLD!"),GRAPHICS_NORMAL); // the stationary string
  unsigned long currentMillis = millis();
  for (int i=0; i <= 8; i++) {
     if(previousMillis - currentMillis > interval) {
       dmd.drawString(event_len1,17,"TOGGLE",strlen("TOGGLE"),GRAPHICS_TOGGLE); // the stationary string
       dmd.drawString(event_len2,25,"TEST",strlen("TEST"),GRAPHICS_TOGGLE); // the stationary string
       delay(300);
    }  
  }
  dmd.clearScreen( true ); 

Library is preventing the use of long arrays

Recently I do simple project where I send pixel data from RaspberryPi via UART. In this project, I created array of ~1000 length (screens are 3x5, it makes around 960 bytes of data). First I created it dynamically via calloc, and memory allocation failed. Changing array to static did not change anything. Then, I removed array and tried to increase Arduino buffer size instead. However, even though I have enough buffer size, my code even wont print something to the Serial (and I am not talking about RPi - Arduino yet).

Font with more than 127 characters: ignored after 127

As french user, I need to display accented characters, such as é, ä, à, ë, ê, ...
The windows fonts have this possibility, special western characters are coded (ISO code) in the range 128..255. For example "é" is the character 233, therefore to allow using such characters, the easy way is to export any windows font, including the characters above nr. 127, using "GLCD FontCreator 2".
The DMD and DMD2 librairy is not able to display these characters because the character index used a "char" variable.
A simple change to "unsined char" corrects the limitation.

In DMD.cpp: function drawChar can be changed as below:

int DMD::drawChar(const int bX, const int bY, const unsigned char letter, byte bGraphicsMode)

avr-gcc complains about fonts not being "const"

the fonts are in PROGMEM but not declared as const.
the new avr-gcc complains about that.

trivial fix, not really worth a clone/pull request etc:

diff --git a/Arial_black_16.h b/Arial_black_16.h
index aa11fd9..638bee5 100644
--- a/Arial_black_16.h
+++ b/Arial_black_16.h
@@ -45,7 +45,7 @@
#define ARIAL_BLACK_16_WIDTH 10
#define ARIAL_BLACK_16_HEIGHT 16

-static uint8_t Arial_Black_16[] PROGMEM = {
+static const uint8_t Arial_Black_16[] PROGMEM = {
0x30, 0x86, // size
0x0A, // width
0x10, // height
diff --git a/SystemFont5x7.h b/SystemFont5x7.h
index 844dfe1..e5ab7e5 100644
--- a/SystemFont5x7.h
+++ b/SystemFont5x7.h
@@ -45,7 +45,7 @@

#define SystemFont5x7 System5x7

-static uint8_t System5x7[] PROGMEM = {
+static const uint8_t System5x7[] PROGMEM = {
0x0, 0x0, // size of zero indicates fixed width font, actual length is width * height
0x05, // width

0x07, // height

how to mirror display

I'm making Head Up Display(HUD) using a DMD panel for which I need a mirrored display. Can anybody help me in this regard that how to mirror the fonts using any built in function or any IC etc.? I shall be much thankful to you.

remove default one pixel space

Hello every body :)

when i use drawMarquee to show message, i would letter close together but i see one pixel space between letters.

how i can remove this one pixel space (maybe : with rebuild library) ?

thanks.

Marquee shows tail of trailing character last pixel

Marquee shows tail of last character's last pixel value, I think the reason is that when shifted only part of string is redrawn and display is left untouched of what is last written there. I think after redraw the amount of shift should be cleared after display shift (a filled box, like space)

Question

#define PIN_OTHER_SPI_nCS 10

in library DMD.h

  1. useful for what #define PIN_OTHER_SPI_nCS 10 ?
  2. Can replace this pin other than 10? because if I replace it will affect the existing display

I ask this because I want to make the pin needed by P10 so that one line with I / O Arduino, starting from pins 8 to 13.

Need to use free font - or pay for licensing Arial

To use Arial, luckily yould not would need the full license, for € 832 - you
can license typfaces separately - € 98 total for regular and black at €49 each.

The better solution seems to be to use a font with a free license instead,
like OpenSans.

A related question: what does the comment in Arial14.h etc mean:

* Arial_14

* created with FontCreator
* written by F. Maximilian Thiele
*
* http://www.apetech.de/fontCreator 

Note the website www.apetech.de no longer exsists (the domain is for sale).

p10 board for arduino

how to add another board and what are the changes on sketch.......plz give some sketch

P10 showing ramdom number

I am using the following code to display characters on P10 LED but what is happening is sometimes the code hangs or sometimes it shows random characters. I have with serial monitor that the socket is being received perfectly.

#include <SPI.h>
#include <DMD.h>
#include <TimerOne.h>
#include <Ethernet.h>
#include "SystemFont5x7.h"
#include "Arial_black_16.h"
#include <Arduino.h>

// Fire up the DMD library as dmd
#define BELT_ID "TLM-1"
IPAddress ip(192, 168, 69, 170); // Static IP address
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xAA}; // MAC address of your Arduino

#define DISPLAYS_ACROSS 2
#define DISPLAYS_DOWN 2
#define MAX_CHAR_ARRAY_SIZE 100

DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN);

String belt_ids;
String belt_id_1;
String belt_id_2;
String count;
String bag_limit;
String vehicle_desctiption;
String receivedData;
String resultant;

char delimiter = '/';
char response[5];
char resultantChar[MAX_CHAR_ARRAY_SIZE];
char vehicleDesctiptionChar[MAX_CHAR_ARRAY_SIZE];
char receivedDataChar[MAX_CHAR_ARRAY_SIZE];

bool is_screen_value_updated = false;
bool is_screen_cleared = false;

int serverPort = 1234; // Port number of the server
int index_of_delimiter;
int resultantCharSize = 0;
int vehicleDesctiptionCharSize = 0;
unsigned long previousPingTime = 0;
const unsigned long pingInterval = 5000; // 5 seconds in milliseconds
unsigned long currentMillis;

int bytesRead = 0;

IPAddress serverIP(192, 168, 69, 150); // IP address of the server
IPAddress gateway(192, 168, 69, 1); // Gateway IP address
IPAddress subnet(255, 255, 255, 0); // Subnet mask

EthernetClient client;

/--------------------------------------------------------------------------------------
Interrupt handler for Timer1 (TimerOne) driven DMD refresh scanning, this gets
called at the period set in Timer1.initialize();
--------------------------------------------------------------------------------------
/
void ScanDMD()
{
dmd.scanDisplayBySPI();
}

int getFreeMemory() {
extern int __heap_start, *__brkval;
int v;
return (int)&v - (__brkval == 0 ? (int)&__heap_start : (int)__brkval);
}

void setup()
{
Serial.begin(9600);

// Initialize Ethernet library
// Ethernet.begin(mac);
Ethernet.begin(mac, ip, gateway, gateway, subnet);

// Wait for Ethernet to be initialized
delay(1000);

Serial.print("IP Address: ");
Serial.println(Ethernet.localIP());

Serial.println("Connecting to server...");
// Connect to the server
connectToServer();

// initialize TimerOne's interrupt/CPU usage used to scan and refresh the display
Timer1.initialize(5000); // period in microseconds to call ScanDMD. Anything longer than 5000 (5ms) and you can see flicker.
Timer1.attachInterrupt(ScanDMD); // attach the Timer1 interrupt to ScanDMD which goes to dmd.scanDisplayBySPI()

// clear/init the DMD pixels held in RAM
dmd.clearScreen(false);
delay(5000);
dmd.clearScreen(true); // true is normal (all pixels off), false is negative (all pixels on)

dmd.drawBox(0, 0, (32 * DISPLAYS_ACROSS) - 1, (16 * DISPLAYS_DOWN) - 1, GRAPHICS_NORMAL);
dmd.selectFont(SystemFont5x7);
}

void loop()
{
int freeMem = getFreeMemory();

Serial.print("Free Memory: ");
Serial.print(freeMem);
Serial.println(" bytes");

if (is_screen_value_updated)
{
dmd.selectFont(SystemFont5x7);
resultant = count + "/" + bag_limit;
resultantCharSize = resultant.length() + 1;
resultant.toCharArray(resultantChar, resultantCharSize);
dmd.drawString(5, 2, resultantChar, resultantCharSize, GRAPHICS_NORMAL);

vehicleDesctiptionCharSize = vehicle_desctiption.length() + 1;
vehicle_desctiption.toCharArray(vehicleDesctiptionChar, vehicleDesctiptionCharSize);
dmd.drawString(2, 1 + 16, vehicleDesctiptionChar, vehicleDesctiptionCharSize, GRAPHICS_NORMAL);
is_screen_value_updated = false;

}
if(is_screen_cleared){
dmd.clearScreen(true); // true is normal (all pixels off), false is negative (all pixels on)

dmd.drawBox(0, 0, (32 * DISPLAYS_ACROSS) - 1, (16 * DISPLAYS_DOWN) - 1, GRAPHICS_NORMAL);
dmd.selectFont(SystemFont5x7);
is_screen_cleared = false;

}
currentMillis = millis();
if (client.connected())
{
// Client is connected
if (client.available())
{
previousPingTime = currentMillis; // Update the last ping time
// Read the data from the server until a . character is encountered
receivedData = client.readStringUntil('.');
receivedData.toCharArray(receivedDataChar, receivedData.length() + 1);

  // Split the string
  char *token = strtok(receivedDataChar, &delimiter);
  while (token != NULL)
  {
    if (token[0] == 'b')
    {
      belt_ids = String(token).substring(2);
      belt_ids.toUpperCase();
      index_of_delimiter = belt_ids.indexOf(',');
      belt_id_1=belt_ids.substring(0, index_of_delimiter);
      belt_id_2=belt_ids.substring(index_of_delimiter+1);
      if(belt_id_1!=BELT_ID && belt_id_2!=BELT_ID){
        break;
      }
    }
    if (token[0] == 'c' && strncmp(token, "clear", sizeof("clear") - 1) == 0){
      is_screen_cleared = true;
    }
    if (token[0] == 'c')
    {
      is_screen_value_updated = true;
      count = String(token).substring(2);
    }

    else if (token[0] == 'l')
    {
      is_screen_value_updated = true;
      bag_limit = String(token).substring(2);
    }

    else
    {
      is_screen_value_updated = true;
      vehicle_desctiption = String(token).substring(2);
      vehicle_desctiption.toUpperCase();
    }

    // Get the next token
    token = strtok(NULL, &delimiter);
  }
}
// Check for server responsiveness every pingInterval milliseconds
if (currentMillis - previousPingTime >= pingInterval) {
  previousPingTime = currentMillis; // Update the last ping time
  if (!pingServer()) {
    // Server not responsive, handle disconnection
    client.stop(); // Disconnect the client
  }
}

}
else
{
// Client is disconnected
Serial.println("Server disconnected!");

// Attempt to reconnect to the server
connectToServer();

}
delay(100);
}

void connectToServer()
{
Serial.println("Connecting to server...");
// Connect to the server
if (client.connect(serverIP, serverPort))
{
Serial.println("Connected!");
}
else
{
Serial.println("Connection failed!");
// Retry connection after a delay
delay(1000);
}
}

bool pingServer() {
client.print("PING\n"); // Send a ping request
delay(100); // Wait for a response

bytesRead = 0;

while (client.available() && bytesRead < sizeof(response)) {
response[bytesRead++] = client.read();
}
response[bytesRead] = '\0'; // Null-terminate the response array
return strcmp(response, "PONG") == 0; // Check if response is as expected
}

Can you please enlighten me on the issue

error message dmd

Hello i have just purchased the dmd and uploaded to uno and have a error message avrdude: usbdev_open(): did not find any usb device "usb" and on the usb driod error message avrdyde: stk500_getsync(): not in sync: rexp=0x00 any assistance would be helpful. Thanks.

I resolved this issue by reinstalling the windows usb drivers. I also noted that the same error can occur when the incorrect usb port was selected or incorrect setup.

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.