Frustrations. having to relearn after years of chronic pain and memory issues.

I am using a NodeMCU esp8266 and an 8x32 ws2812B 3 lead display
I am trying to make a scrolling weather weather display.
I have all the code in place, it pulls the info correctly and I know it sends it to the display but it only displays only new line at a time and only when it updates the weather. So it is only updating it at

long timerDelay = 30000;

I know I have a lot of junk code in here still Im just working on getting it going right now then cleaning.

#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <WiFiClient.h>
#include <Arduino_JSON.h>

#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
#ifndef PSTR
#define PSTR // Make Arduino Due happy

#define PIN            14 // This is the D5 pin

// Weather

const char* ssid = "SSID";
const char* password = "PASSWORD";

// Your Domain name with URL path or IP address with path
// Example:
//String openWeatherMapApiKey = "7a758cf0f76e4eadf6224e6a8196669c";

// Replace with your country code and city
String zip = "67213";
String countryCode = "US";

// For a final application, check the API call limits per hour/minute to avoid getting blocked/banned
unsigned long lastTime = 0;
// Timer set to 5 minutes (300000);
//unsigned long timerDelay = 300000;
// Set timer to 10 seconds (10000);
unsigned long timerDelay = 30000;

String jsonBuffer;

// Neo

// Parameter 1 = width of NeoPixel matrix
// Parameter 2 = height of matrix
// Parameter 3 = pin number (most are valid)
// Parameter 4 = matrix layout flags, add together as needed:
//     Position of the FIRST LED in the matrix; pick two, e.g.
//     NEO_MATRIX_TOP + NEO_MATRIX_LEFT for the top-left corner.
//   NEO_MATRIX_ROWS, NEO_MATRIX_COLUMNS: LEDs are arranged in horizontal
//     rows or in vertical columns, respectively; pick one or the other.
//   NEO_MATRIX_PROGRESSIVE, NEO_MATRIX_ZIGZAG: all rows/columns proceed
//     in the same order, or alternate lines reverse direction; pick one.
//   See example below for these values in action.
// Parameter 5 = pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_GRBW    Pixels are wired for GRBW bitstream (RGB+W NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)

// Example for NeoPixel Shield.  In this application we'd like to use it
// as a 5x8 tall matrix, with the USB port positioned at the top of the
// Arduino.  When held that way, the first pixel is at the top right, and
// lines are arranged in columns, progressive order.  The shield uses
// 800 KHz (v2) pixels that expect GRB color data.
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(32, 8, PIN,
                            NEO_TILE_TOP   + NEO_TILE_LEFT   + NEO_TILE_ROWS   + NEO_TILE_ZIGZAG +
                            NEO_GRB + NEO_KHZ800);

const uint16_t colors[] = {
  matrix.Color(127, 0, 127), matrix.Color(127, 0, 127), matrix.Color(127, 0, 127)

void setup() {
  // Weather

  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
  Serial.print("Connected to WiFi network with IP Address: ");

  Serial.println("Timer set to 5 minutes (timerDelay variable), it will take 5 minutes before publishing the first reading.");

  // Neo

int x    = matrix.width();
int pass = 0;

void loop() {
  // Send an HTTP GET request
  if ((millis() - lastTime) > timerDelay) {
    // Check WiFi connection status
    if (WiFi.status() == WL_CONNECTED) {
      String serverPath = "OPEN WEATHER MAP ADDRESS";

      jsonBuffer = httpGETRequest(serverPath.c_str());
      JSONVar myObject = JSON.parse(jsonBuffer);

      // JSON.typeof(jsonVar) can be used to get the type of the var
      if (JSON.typeof(myObject) == "undefined") {
        Serial.println("Parsing input failed!");

      //Serial.print("JSON object = ");
      Serial.print("Temp: ");
      Serial.print("    Feels like:");
      Serial.print("    Wind Speed: ");
      Serial.print("    Humidity: ");

      matrix.setCursor(x, 0);
      matrix.print("Temp: ");
      matrix.print("    Feels like:");
      matrix.print("    Wind Speed: ");
      matrix.print("    Humidity: ");
      if (--x < -15) {
        x = matrix.width();
        if (++pass >= 3) pass = 0;

    else {
      Serial.println("WiFi Disconnected");
    lastTime = millis();

String httpGETRequest(const char* serverName) {
  HTTPClient http;

  // Your IP address with path or Domain name with URL path

  // Send HTTP POST request
  int httpResponseCode = http.GET();

  String payload = "{}";

  if (httpResponseCode > 0) {
    Serial.print("HTTP Response code: ");
    payload = http.getString();
  else {
    Serial.print("Error code: ");
  // Free resources

  return payload;


II THINK it has something to do with the two being in the void loop keeping it from working right.
My brain is having troubles relearning stuff but I’m trying to do something i use to love to keep me from boredom.
any help would be great. and I think you in advance.

Don’t you need to clear the Matrix (buffer) before you start writing to it again ?

if (--x < -15) {
        x = matrix.width();
        if (++pass >= 3) pass = 0;

It’s this part that i am not really sure what it actually does.
You’ve set the timer to 30 seconds for now (conflict with the comments, but understandable)
Anyway, let me tell you now that you can not get a stable WiFi connection on an ESP8266 while you send a bit-banged signal to a a ws281x repeatedly. the neopixel library does that. You need to switch libraries. neopixelbus has a DMA mode (default on an ESP) and a UART mode that can provide you with a stable wifi connection (interrupts always enabled) There are some limitations to the use of the pin. I am not sure it has a matrix mode (it might it is quite complete) but it should not be hard to write the mapping yourself if you have to. I don’t know how big you matrix is but keep in mind that DMA-mode requires 4x the normal buffer size. Still on an ESP that is rarely an issue, but a matrix on an ESP-01 may get a little tight in memory.

if (--x < -15) {[color=#222222][/color]
        x = matrix.width();[color=#222222][/color]
        if (++pass >= 3) pass = 0;[color=#222222][/color]

Here is is being used to limit the buffer size of the input text. and switching the color on each of 3 passes that the text travels.

Here is is being used to limit the buffer size of the input text. and switching the color on each of 3 passes that the text travels.

If you say so. Probably not where your issue is. Your issue is probably not caused by the bit-banged signal either, but that will cause future issues. Could you please also describe again clearly what exactly goes wrong, and why you don't completely clear the buffer before you start ?

What should happen.
==> The code is to pull date from openweathermaps
==> json in parsed
==> parsed data is displayed on a scrolling LED matrix (32x8 leds)
==> wait Xtime repeat

what is happening
==> The code is to pull date from openweathermaps
==> json in parsed
==> parsed data is displayed on a scrolling LED matrix (32x8 leds) ***data does not scroll but just advances one column
waits Xtime repeats.

something tells me that you want this section to loop

      matrix.setCursor(x, 0);
      matrix.print("Temp: ");
      matrix.print("    Feels like:");
      matrix.print("    Wind Speed: ");
      matrix.print("    Humidity: ");
      if (--x < -15) {
        x = matrix.width();
        if (++pass >= 3) pass = 0;

Because as it is at the moment, it will only be executed every time the weather data is read.
I am not to familiar with these matrix functions, but i suspect you scroll the text by setting the cursor to a negative (and decreasing number) am i correct ? Then there needs to be some while loop here.
Or hold on, should it just be an ‘else’ to this if statement ?if ((millis() - lastTime) > timerDelay) { That would cause the the text to be scrolling continuously until the new data is read and updated, and then start over.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.