1

I am using ESP8266 NodeMCU with MAX7219 and a DS3231 teal time clock. I want to display the time and some text. The display is made of 4 FC16 modules which are made of 4 8x8 MAX7219 led matrix modules so it would be a 32x32 led matrix diplay divided in 4 rows. I am displaying the time hh:mm on the last row and text on the first 3 rows.

With ESP8266 I connected to my wi-fi and I created a web server which says "Hello World!"

So my question is: how do I upload my code to the web server so I can change the text remotely?

I found this tutorial https://maker.pro/esp8266/tutorial/how-to-build-an-led-matrix-display-with-a-nodemcu-esp8266 that shows how to change the text on one row of display but I don't want something that fancy. I just want my code uploaded and to be able to change in the code.

#include "RTClib.h"
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>

ESP8266WebServer server;

// Define the number of devices we have in the chain and the hardware interface // NOTE: These pin numbers will probably not work with your hardware and may // need to be adapted #define HARDWARE_TYPE MD_MAX72XX::FC16_HW #define MAX_DEVICES 12 #define NUM_ZONES 3

int CS_PIN = D4; int CLK_PIN = D5; int DATA_PIN = D7;

// Hardware SPI connection MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES); // Arbitrary output pins // MD_Parola P = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);

RTC_DS3231 rtc; #define SPEED_TIME 25 #define PAUSE_TIME 1000

uint8_t lastUpdateMin = 0; uint8_t lastUpdateHour = 0;

// Global variable const char *pc[NUM_ZONES] = { "TIME", //0 "ROOM", //1 "SUBJECT", //2 //"GRADE",//3 };

void setup(void) { Serial.begin(115200); Serial.println();

WiFi.begin("ssid", "password");

Serial.print("Connecting"); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println();

Serial.print("Connected, IP address: "); Serial.println(WiFi.localIP()); server.on("/", { server.send(200, "text/plain", "Hello World!"); }); server.begin();

P.begin(); if (! rtc.begin()) { Serial.println("Couldn't find RTC"); while (1); }

if (rtc.lostPower()) { Serial.println("RTC lost power, lets set the time!"); // If the RTC have lost power it will set the RTC to the date & time this sketch was compiled in the following line rtc.adjust(DateTime(F(DATE), F(TIME))); }

P.begin(3); P.setZone(0, 0, 3); // Modules 0-3 in zone 0 P.setZone(1, 4, 7); // Modules 4-7 in zone 1 P.setZone(2, 8, 11); // Modules 8-11 in zone 2 // P.setZone(3, 12, 15); // Modules 12-15 in zone 3 }

void loop(void) { server.handleClient(); DateTime now = rtc.now(); if (lastUpdateMin != now.minute()) { // change every minute lastUpdateMin = now.minute(); char buffer[] = "hh:mm"; // hours and minutes P.displayZoneText(0, now.toString(buffer), PA_CENTER, 0, 0, PA_PRINT, PA_NO_EFFECT); } if (lastUpdateHour != now.hour()) { // change every hour lastUpdateHour = now.hour(); P.displayZoneText(1, pc[1], PA_CENTER, 0, 0, PA_PRINT, PA_NO_EFFECT); // 2nd row P.displayZoneText(2, pc[2], PA_CENTER, 0, 0, PA_PRINT, PA_NO_EFFECT); // 3rd row // P.displayZoneText(3, pc[3], PA_CENTER, 0, 0, PA_PRINT, PA_NO_EFFECT); // 4th row } P.displayAnimate(); }

jsotola
  • 1,554
  • 2
  • 12
  • 20
Rehoboam
  • 27
  • 7

0 Answers0