Hello all,
Iam very much new to Arduino programming. I am making counter with P10 display.
P10 display is not displaying anything. Can you guys please help me
#include <DMDESP.h>
#include <fonts/ElektronMart6x8.h>
#include <fonts/Mono5x7.h>
#include <fonts/EMSans8x16.h>
#define DISPLAYS_WIDE 1 //--> Panel Columns
#define DISPLAYS_HIGH 1 //--> Panel Rows
DMDESP Disp(DISPLAYS_WIDE, DISPLAYS_HIGH);
String str;
char b[8];
int sec;
const int led=9;
int count;
const int up=10;
int ups;
void setup() {
// Initialize Serial Monitor
Serial.begin(115200);
pinMode(up, INPUT);
pinMode(led, OUTPUT);
pinMode(up, INPUT);
pinMode(led, OUTPUT);
sec=0;
up==0;
count=0;
Disp.start(); //--> Run the DMDESP library
Disp.setBrightness(50); //--> Brightness level
Disp.setFont(Mono5x7);
}
void loop() {
bool k=1;
ups=digitalRead(up);
if ((ups ==HIGH) or (k==1))
{
delay(1000);
sec++;
Serial.println(sec);
}
else
{
sec=0;
digitalWrite(led, LOW);
}
if (sec==25)
{
count++;
digitalWrite(led, HIGH);
}
Disp.loop(); // Jalankan Disp loop untuk refresh LED
Disp.setBrightness(100);
Disp.setFont(Mono5x7);
Disp.drawText(0, 0, String(count));
Serial.println(count);
}
Hello PaulRB,
Thank you for immediate response.
Yes i have tested sample codes and it is running fine, P10 also displaying fine.
Esp8266 Controller and P10 display are brand new. No problem with Hardware.
Only problem is with my code. It doesnt show anything.
The problem is that your coding skills are much too low. You are at the stage of copying lines of code from different sketches with no understanding of their meaning or purpose. This technique will always fail.
You need to begin by following a series of tutorials or a book aimed at complete beginners to arduino and coding. I'm sorry, I can't recommend any particular tutorials, perhaps other forum members can recommend something.
When you have gained some basic understanding, you can return to your P10 display project. But do not use the above code. Start with the simplest of the example sketches from the library and make small, step-by-step changes toward your desired project, testing the circuit at each stage.
@naaga
Such panels use the principle of dynamic indication. In order for them to work, the data on them must be updated 100-200 times per second. Unlike most similar ones, this library does not have a built-in updater, for example, by a timer - you must constantly run the method
in the loop().
Therefore your code MUST not contain delay() statements and other blocking code longer than 5-10 ms. A 1 second delay in your code completely blocks the work of the panels.
Try to rewrite the code without using delays using millis