freetronics / dmd Goto Github PK
View Code? Open in Web Editor NEWArduino library to support the Freetronics Dot Matrix Display
Home Page: www.freetronics.com/dmd
Arduino library to support the Freetronics Dot Matrix Display
Home Page: www.freetronics.com/dmd
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)
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)
I want to implement scrolling from left to right and up to down. how do i implement it?
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 );
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
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
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.
#define PIN_OTHER_SPI_nCS 10
in library DMD.h
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.
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.
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).
LEDs on P10 are blinkinkg very fast when I use Arduino DUE. How can I solve this problem ?
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).
how i can translate text in arabic unicode to be fit the lib
how to make muslim pryer time
how to add another board and what are the changes on sketch.......plz give some sketch
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.