0% found this document useful (0 votes)
208 views4 pages

P10 LED Display Code for ESP8266

Uploaded by

nuttapungnls94
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
208 views4 pages

P10 LED Display Code for ESP8266

Uploaded by

nuttapungnls94
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

//

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>> Test P10
/*
* Original source code :
[Link]
[Link] by busel7
* Links to download libraries : [Link]
*/

//----------------------------------------Include Library
//----------------------------------------see here: [Link]
v=8jMr94B8iN0 to add NodeMCU ESP8266 library and board
#include <DMDESP.h>
#include <fonts/ElektronMart6x8.h>
#include <fonts/Mono5x7.h>
#include <fonts/EMSans8x16.h>

//----------------------------------------
#include <ESP8266WiFi.h>
#include <time.h>

//----------------------------------------DMD Configuration (P10 Panel)


#define DISPLAYS_WIDE 2 //--> Panel Columns
#define DISPLAYS_HIGH 1 //--> Panel Rows
DMDESP Disp(DISPLAYS_WIDE, DISPLAYS_HIGH); //--> Number of Panels P10 used
(Column, Row)

int timezone = 7*3600;


int dst = 0;
bool a;
int WD = 64;

int nw = 0;
String nww,nwh,nws,mytime;

// =======================================================================
// CHANGE YOUR CONFIG HERE:
// =======================================================================
const char* ssid = "M30"; // SSID of local network
const char* password = "97569756"; // Password on network

//========================================================================VOID
SETUP()
void setup() {
//----------------------------------------DMDESP Setup
[Link](); //--> Run the DMDESP library
[Link](50); //--> Brightness level
[Link](Mono5x7); //--> Determine the font used
//----------------------------------------

[Link](WIFI_STA);
[Link](ssid,password);
while ([Link]() != WL_CONNECTED)
{
delay(1000);
}
configTime(timezone,dst,"[Link]","[Link]");
time_t now = time(nullptr);
struct tm* p_tm = localtime(&now);
nw = now;
a = false;

//========================================================================VOID
LOOP()

void loop() {

if (a==true)
{
Scrolling_Text(0, 40); //--> Show running text "Scrolling_Text(y
position, speed);"
a = false;
}

[Link](100);
[Link]();
[Link](EMSans8x16);

Clock_itt(); // show time

}
//========================================================================

//
========================================================================Subroutines
for scrolling Text
static char *Text[] = {"Thaimean 0897233733"};

void Scrolling_Text(int y, uint8_t scrolling_speed) {


static uint32_t pM;
static uint32_t x; int width = [Link]();
[Link](Mono5x7);
// [Link](ElektronMart6x8);

int fullScroll = [Link](Text[0]) + width;


if((millis() - pM) > scrolling_speed) {
pM = millis();
if (x < fullScroll) {
++x;
} else {
x = 0;
return;
}
[Link](width - x, y, Text[0]);
}
}
//========================================================================

void Clock_itt() {

time_t now = time(nullptr);


struct tm* p_tm = localtime(&now);

nwh = p_tm->tm_hour;
nww = p_tm->tm_min;
nws = p_tm->tm_sec;

int v = [Link]();
int va = [Link]();

if (va < 10) {


nww = '0'+nww;
}

if (v<10) {
nws = '0'+nws;
}

mytime = nwh+":"+nww+":"+nws;

if (v < 30) {
a = true;

if (v==0) {

for (int s=0; s<WD;s++)


{

for (int j=0;j<17;j++)


{
[Link](s,j,0);
}
}
}

}
else
{
if (v==30)
{
for (int s=0; s<WD;s++)
{

for (int j=0;j<17;j++)


{
[Link](s,j,0);
}

}
}

a = false;
}

if (a==false) // big clock


{
[Link](100);
[Link]();
[Link](EMSans8x16);
[Link](0, 0, mytime);
}
else // true // small clock run
{
[Link](100);
[Link](Mono5x7);
[Link](7, 8, mytime);
}
}

You might also like