And now ?
I took some things away and started testing a P10 LED panel, an esp8266 NodeMcu12E, a 433Mhz garage door remote control and Telegram.
But the fastBOT library is interfering with the P10 panel display. Every 5 seconds the panel goes completely off for about 100 milliseconds and comes on again, and stays like that forever. Working, but with this 'defect'.
I believe it is because fastBOT monitors every 5 seconds to see if there are any messages coming from Telegram.
But is it impossible to avoid this panel defect?
Does anyone have any: try this ?
// https://github.com/busel7/DMDESP
// https://github.com/GyverLibs/FastBot
#include <DMDESP.h>
#include <fonts/ElektronMart6x8.h>
#include <fonts/Mono5x7.h>
#include <RCSwitch.h>
#include <FastBot.h>
#include <ESP8266WiFi.h>
#define BOT_TOKEN "1234866909:DFSJDJSJFHyfEJzNqtpB2F2NwXT1lDSKbu4Q1f3Cmo"
#define CHAT_ID "5112388909"
FastBot bot(BOT_TOKEN);
RCSwitch mySwitch = RCSwitch();
#define DISPLAYS_WIDE 1 //--> Panel Columns
#define DISPLAYS_HIGH 1 //--> Panel Rows
DMDESP Disp(DISPLAYS_WIDE, DISPLAYS_HIGH); //--> Number of Panels P10 used (Column, Row)
int nowifi;
char ssid[20] = "AAAAAAAA";
char password[20] = "BBBBBBBB";
int cron;
void setup() {
Serial.begin(115200);
delay(2000);
mySwitch.enableReceive(D2);
WiFi.mode(WIFI_STA);
Serial.print("Conectando em: ");Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
nowifi++;
Serial.print(nowifi);
if(nowifi > 9) {
ESP.restart();
}
}
bot.setToken(BOT_TOKEN); //se quiser alterar o TOKEN por este método
bot.setChatID(CHAT_ID); //se quiser alterar o CHAT_ID por este método
bot.attach(newMsg); // Ativa a função de manipulador
bot.setBufferSizes(512, 512); //Buffer de entrada, buffer de saída. Pode ser 1024, 512
Disp.start(); //--> Run the DMDESP library
Disp.setBrightness(50); //--> Brightness level
Disp.setFont(Mono5x7); //--> Determine the font used
}
void loop() {
if (mySwitch.available()) {
Serial.print("Received ");
Serial.print( mySwitch.getReceivedValue() );
Serial.print(" / ");
Serial.print( mySwitch.getReceivedBitlength() );
Serial.print("bit ");
Serial.print("Protocol: ");
Serial.println( mySwitch.getReceivedProtocol() );
mySwitch.resetAvailable();
}
// bot.tickManual();
bot.tick();
Disp.loop(); //--> Run "Disp.loop" to refresh the LED
Disp.drawText(4, 0, "TEST"); //--> Display text "Disp.drawText(x position, y position, text)"
Scrolling_Text(9, 50); //--> Show running text "Scrolling_Text(y position, speed);"
}
void newMsg(FB_msg& msg) {
if(msg.text == "/start") {
bot.sendMessage("Hello !");
msg.text = "";
}
}
//========================================================================Subroutines for scrolling Text
static char *Text[] = {"Test Panel P10"};
void Scrolling_Text(int y, uint8_t scrolling_speed) {
static uint32_t pM;
static uint32_t x;
int width = Disp.width();
Disp.setFont(Mono5x7);
int fullScroll = Disp.textWidth(Text[0]) + width;
if((millis() - pM) > scrolling_speed) {
pM = millis();
if (x < fullScroll) {
++x;
} else {
x = 0;
return;
}
Disp.drawText(width - x, y, Text[0]);
}
}
if (yes) {
thanks++;
}