Topic: Remotexy Wemos D1 R1 with P10 DMD
Hi this is my first poject using remotexy
here it is my goal
- using wemos d1 r1 as client to control Dot Matrix Display P10 32 x 64 ( 4 panel )
- the display will show the queue number from 0000 - 9999
- remotexy app have 3 button up,down,and reset
- using cloud server service
the problem i had
- the dmd using dmd2.h library, everytime i use dmd.begin function,the connection cannot be established between remotexy app and the wemos board.
- but if i put delay before dmd.begin on my void setup, connection can be established,but sometimes the wdt reset
- on remotexy app,button only response and send command to client if i hold it,if i tap, the button doesn't work
- since sometimes the button i hold it for too long,the count come doubled
- if the button need to be hold,can i display the counting on my remotexy also?,but i really hope the tap works, its better if i can display the counting on remotexy too, since the dmd display will be not visible to the operator on remotexy
- does remotexy have autoconnect features?,like if the wifi cant be established, the board will become AP, then i can access with ip address of the board to setup the SSID and Password.
here it is the sketch that i upload to my wemos board
//////////////////////////////////////////////
// RemoteXY include library //
//////////////////////////////////////////////
// RemoteXY select connection mode and include library
#define REMOTEXY_MODE__ESP8266WIFI_LIB_CLOUD
#include <ESP8266WiFi.h>
#include <RemoteXY.h>
// RemoteXY connection settings
#define REMOTEXY_WIFI_SSID "ANDLYSTA"
#define REMOTEXY_WIFI_PASSWORD "baitijannati"
#define REMOTEXY_CLOUD_SERVER "cloud.remotexy.com"
#define REMOTEXY_CLOUD_PORT 6376
#define REMOTEXY_CLOUD_TOKEN "16909da5f60077751bd4598cbb649564"
// RemoteXY configurate
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
{ 255, 14, 0, 0, 0, 62, 0, 10, 186, 1,
1, 0, 17, 23, 28, 28, 35, 31, 85, 80,
0, 1, 0, 20, 57, 23, 23, 2, 31, 68,
79, 87, 78, 0, 1, 0, 48, 86, 12, 12,
2, 31, 88, 0, 129, 0, 17, 2, 28, 8,
94, 65, 110, 116, 114, 105, 97, 110, 0, 7,
5, 4, 12, 58, 8, 2, 26, 2, 11
};
// this structure defines all the variables and events of your control interface
struct {
// input variables
uint8_t button_1; // =1 if button pressed, else =0
uint8_t button_2; // =1 if button pressed, else =0
uint8_t RST; // =1 if button pressed, else =0
char No_Antrian[11]; // string UTF8 end zero
// other variable
uint8_t connect_flag; // =1 if wire connected, else =0
} RemoteXY;
#pragma pack(pop)
/////////////////////////////////////////////
// END RemoteXY include //
/////////////////////////////////////////////
#define PIN_BUTTON_1 1
#define PIN_BUTTON_2 3
#define PIN_RST 5
#include <DMD2.h>
#include <SPI.h>
#include "calibri13.h"
#define pin_A 16
#define pin_B 12
#define pin_sclk 0
#define pin_noe 15
#define panel_width 2
#define panel_heigh 2
SPIDMD dmd(panel_width, panel_heigh, pin_noe, pin_A, pin_B, pin_sclk); // DMD controls the entire display
char dmdBuff[10];
int counter = 0;
int val = 0;
unsigned long previousMillis = 0;
const long interval = 1000;
//int debounce = 20;
void setup()
{
RemoteXY_Init ();
pinMode (PIN_BUTTON_1, OUTPUT);
pinMode (PIN_BUTTON_2, OUTPUT);
pinMode (PIN_RST, OUTPUT);
delay(5000); // this is delay that i mentioned,if i uncomment this,the board cant be connected
// TODO you setup code
dmd.beginNoTimer();
dmd.setBrightness(255);
dmd.selectFont(calibri13);
dmd.begin();
dmd.clearScreen();
delay(20);
}
void loop()
{
RemoteXY_Handler ();
digitalWrite(PIN_BUTTON_1, (RemoteXY.button_1 == 0) ? LOW : HIGH);
digitalWrite(PIN_BUTTON_2, (RemoteXY.button_2 == 0) ? LOW : HIGH);
digitalWrite(PIN_RST, (RemoteXY.RST == 0) ? LOW : HIGH);
// TODO you loop code
// use the RemoteXY structure for data transfer
// do not call delay()
sprintf(dmdBuff, "%.4d", counter);
dmd.drawString( 4, 2, dmdBuff );
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {
// save the last time you blinked the LED
previousMillis = currentMillis;
val = digitalRead(PIN_BUTTON_1);
if (val == 1) {
counter++;
// delay(debounce);
} else if (digitalRead(PIN_RST) == 1) {
dmd.clearScreen();
counter = 0;
// delay(debounce);
} else if (digitalRead(PIN_BUTTON_2) == 1) {
counter--;
// delay(debounce);}
}
}
}