Upload error to nodemcu

Hi Guy's,

I'm getting an erroe when trying to upload to a nodemcu.

From past experience I think it may be that the library is in the wrong place.

Where should it be on an apple mac?

Arduino: 1.8.12 (Mac OS X), Board: "NodeMCU 0.9 (ESP-12 Module), 80 MHz, Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache + 32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, 4MB (FS:2MB OTA:~1019KB), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

dyld: lazy symbol binding failed: Symbol not found: _getentropy
Referenced from: /Users/******/Library/Arduino15/packages/esp8266/tools/python3/3.7.2-post1/python3
Expected in: /usr/lib/libSystem.B.dylib

dyld: Symbol not found: _getentropy
Referenced from: /Users/******/Library/Arduino15/packages/esp8266/tools/python3/3.7.2-post1/python3
Expected in: /usr/lib/libSystem.B.dylib

signal: trace/BPT trap
Error compiling for board NodeMCU 0.9 (ESP-12 Module).
java.lang.NullPointerException
java.lang.RuntimeException: java.lang.NullPointerException
at cc.arduino.contributions.libraries.ui.LibraryManagerUI.lambda$onUpdatePressed$2(LibraryManagerUI.java:207)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
at cc.arduino.contributions.libraries.ui.ContributedLibraryReleasesComparator.compare(ContributedLibraryReleasesComparator.java:49)
at cc.arduino.contributions.libraries.ui.ContributedLibraryReleasesComparator.compare(ContributedLibraryReleasesComparator.java:39)
at java.util.TimSort.binarySort(TimSort.java:296)
at java.util.TimSort.sort(TimSort.java:239)
at java.util.Arrays.sort(Arrays.java:1512)
at java.util.ArrayList.sort(ArrayList.java:1462)
at java.util.Collections.sort(Collections.java:177)
at cc.arduino.contributions.libraries.ui.LibrariesIndexTableModel.updateContributions(LibrariesIndexTableModel.java:208)
at cc.arduino.contributions.libraries.ui.LibrariesIndexTableModel.update(LibrariesIndexTableModel.java:138)
at cc.arduino.contributions.libraries.ui.LibraryManagerUI.lambda$onUpdatePressed$2(LibraryManagerUI.java:204)

Hi @dizzwold. Which version of macOS are you using?

I think this problem is caused by using an older version of macOS:

Unfortunately, that discussion was derailed by the rude attitude of the fellow who reported the issue.

Hi inO,

Wow, that was quite unpleasant reading.

I'm on 10.11.6 , and that'sthe highest this mac will go.

In reading the awfulness you linked to, I read about;
the python3 executable installed in the tools dir and make a symlink to your system's native Python3 interpreter
Where is the Tools Dir located and how would I go about system link?

I'd be grateful for any input. I've also tried with the following link, but this didn't fix the problem;
https://arduino-esp8266.readthedocs.io/en/latest/faq/a04-board-generic-is-unknown.html

It is here:

/Users/******/Library/Arduino15/packages/esp8266/tools/python3/3.7.2-post1/

You use ln -s:
https://ss64.com/osx/ln.html


There is an easy workaround, which is to use the last version of the ESP8266 boards platform that is compatible with your version of macOS. That's not a great solution because there have likely been some valuable advancements in the project since that time, but the older versions will most likely work perfectly well for you. From the comment here, I believe that 2.5.2 is the last compatible version.

I'll go ahead and provide you with the instructions for that workaround:

  1. Select Tools > Board > Boards Manager from the Arduino IDE menus.
  2. Wait for the updates to finish.
  3. Scroll down through the list of boards platforms until you see "esp8266 by ESP8266 Community". Click on it.
  4. From the "Select version" menu, select "2.5.2".
  5. Click the Install button.
  6. Wait for the installation to finish.
  7. Click the Close button.

Now you can try uploading again.

If you try this workaround, you should note that if you later update to the incompatible versions of the ESP8266 boards platform then the error will come back again. If you have "Check for updates on startup" enabled in the Arduino IDE's File > Preferences menu, it will periodically notify you that a new version is available, so you will either need to disregard these notifications or else disable that setting.

Hi in0,

Yeay, that fixed it.

Well done that man, you get a cookie.

Thank you for your help.

It's been quite a while since I was on here last. What ever happened to the Kama button and the code insert?
ps, you don't know how happy I am to see a little blink sketch working. Lol.

You're welcome. I'm glad to hear it's working now.

We changed the forum software from SMF to Discourse last spring (more about that than you would ever want to read here). That resulted in some fairly significant changes to the forum interface.

But even if it looks and works a bit different now, we're all still here for the same reason as always: to learn and share knowledge about this thing we call "Arduino".

Hmm,

Moving on, what I intend to do is use Webthings by a well known browser provider and use the nodemcu's as the Things.

I Thought I'd installed all the libraries needed, but I get the following error when uploading;

Arduino: 1.8.12 (Mac OS X), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Disabled, All SSL ciphers (most compatible), 4M (2M SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

In file included from /Users//Documents/Arduino/WebLEDLamp/WebLEDLamp.ino:15:0:
/Users/
/Documents/Arduino/libraries/webthing-arduino-master/Thing.h:19:31: fatal error: ESPAsyncWebServer.h: No such file or directory
#include <ESPAsyncWebServer.h>
^
compilation terminated.
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Is this becasue I'm having to use a previous version of the ESP8266 library (2.5.2 on old mac)?

Dizzwold.

Hi Guy's,

Now I know this could get a little political, but due to only have an old apple mac that I can't upgrade any further then 10.11.6, I thought I'd use a Raspberry Pi as a computer running raspios butler desktop with recommended software along with the Arduino IDE. Good idea?

Anyway, I've installed the Arduino IDE a few times in diferent ways and everytime I do, It's always missing the toolbar across the top Arduino, File, Edit, Sketch, tools and Help.

I've tried installing directly from the Arduino website then moving the files over to /opt and I've also tried the command line sudo apt-get install arduino.

Can anyone share a solution to remedy this problem?

In addition to the immediate sketch dependencies, the libraries used by the sketch may have their own dependencies on other libraries. It appears the "webthing" library has a dependency on the "ESP Async WebServer" library.

Unfortunately, the "ESP Async WebServer" library was never added to the Arduino Library Manager index, so it is necessary to use an alternative installation method. I'll provide you with instructions for that:

  1. Click in this link to download the library: https://github.com/me-no-dev/ESPAsyncWebServer/archive/refs/heads/master.zip
  2. Select Sketch > Include Library > Add .ZIP Library... from the Arduino IDE menus.
  3. Select the file you just downloaded ("ESPAsyncWebServer-master.zip").
  4. Click the Open button.

That should fix the error.

I don't think it is related.

I think so. There are a couple of problems that come up from time to time:

The Arduino development software occasionally has compatibility problems with the lower spec ARM cores on some RPi like the Zero. I think the classic IDE is working fine at this time (though the limited computing power of the Zero makes it a painful user experience).

Arduino IDE 2.x does not have any official ARM Linux support at this time:

But note there is a link in that thread to a 3rd party project that does provide support, so it is possible. Anyway, Arduino IDE 2.x is currently in a beta development state so you are probably better with the 1.8.16 anyway.

Some of the boards platforms don't provide a version of their toolchain that was compiled for the Linux ARM host architecture. This means you can't install them via Boards Manager.

It sounds like this issue:

The community has shared a fix for it at the link I shared above.

That will give you a super outdated version of the Arduino IDE. So I very much recommend against that installation method. However, I don't have reason to believe the antiquity of it is related to your problem.

Hi Guy's,

I can get the arduino-webthings example sketch LED to work, but not the LED Lamp on my NodeMCu?

Could this be a result of using the ESP8266 library (2.5.2 on old mac)?

I'm not brilliant at coding, but tried a few thing and got no success.

Can someone give me some pointers in the right direction?

/**
 * Simple server compliant with Mozilla's proposed WoT API
 * Originally based on the HelloServer example
 * Tested on ESP8266, ESP32, Arduino boards with WINC1500 modules (shields or
 * MKR1000)
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
//#define LARGE_JSON_DOCUMENT_SIZE 8192
//#define SMALL_JSON_DOCUMENT_SIZE 2048
#define LARGE_JSON_BUFFERS 1
//#define ARDUINOJSON_USE_LONG_LONG 1

#include <Arduino.h>
#include <Thing.h>
#include <WebThingAdapter.h>

#ifdef ESP32
#include <analogWrite.h>
#endif

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

#if defined(LED_BUILTIN)
const int lampPin = LED_BUILTIN;
#else
const int lampPin = 16; // manually configure LED pin
#endif

ThingActionObject *action_generator(DynamicJsonDocument *);

WebThingAdapter *adapter;

const char *lampTypes[] = {"OnOffSwitch", "Light", nullptr};
ThingDevice lamp("urn:dev:ops:my-lamp-1234", "My Lamp", lampTypes);

ThingProperty lampOn("on", "Whether the lamp is turned on", BOOLEAN,
                     "OnOffProperty");
ThingProperty lampLevel("brightness", "The level of light from 0-100", INTEGER,
                        "BrightnessProperty");

StaticJsonDocument<256> fadeInput;
JsonObject fadeInputObj = fadeInput.to<JsonObject>();
ThingAction fade("fade", "Fade", "Fade the lamp to a given level",
                 "FadeAction", &fadeInputObj, action_generator);
ThingEvent overheated("overheated",
                      "The lamp has exceeded its safe operating temperature",
                      NUMBER, "OverheatedEvent");

bool lastOn = true;

void setup(void) {
  pinMode(lampPin, OUTPUT);
  digitalWrite(lampPin, HIGH);
  Serial.begin(115200);
  Serial.println("");
  Serial.print("Connecting to \"");
  Serial.print(ssid);
  Serial.println("\"");
#if defined(ESP8266) || defined(ESP32)
  WiFi.mode(WIFI_STA);
#endif
  WiFi.begin(ssid, password);
  Serial.println("");

  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println("");
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());
  adapter = new WebThingAdapter("led-lamp", WiFi.localIP());

  lamp.description = "A web connected lamp";

  lampOn.title = "On/Off";
  lamp.addProperty(&lampOn);

  lampLevel.title = "Brightness";
  lampLevel.minimum = 0;
  lampLevel.maximum = 100;
  lampLevel.unit = "percent";
  lamp.addProperty(&lampLevel);

  fadeInputObj["type"] = "object";
  JsonObject fadeInputProperties =
      fadeInputObj.createNestedObject("properties");
  JsonObject brightnessInput =
      fadeInputProperties.createNestedObject("brightness");
  brightnessInput["type"] = "integer";
  brightnessInput["minimum"] = 0;
  brightnessInput["maximum"] = 100;
  brightnessInput["unit"] = "percent";
  JsonObject durationInput =
      fadeInputProperties.createNestedObject("duration");
  durationInput["type"] = "integer";
  durationInput["minimum"] = 1;
  durationInput["unit"] = "milliseconds";
  lamp.addAction(&fade);

  overheated.unit = "degree celsius";
  lamp.addEvent(&overheated);

  adapter->addDevice(&lamp);
  adapter->begin();

  Serial.println("HTTP server started");
  Serial.print("http://");
  Serial.print(WiFi.localIP());
  Serial.print("/things/");
  Serial.println(lamp.id);

#ifdef analogWriteRange
  analogWriteRange(255);
#endif

  // set initial values
  ThingPropertyValue initialOn = {.boolean = true};
  lampOn.setValue(initialOn);
  (void)lampOn.changedValueOrNull();

  ThingPropertyValue initialLevel = {.integer = 50};
  lampLevel.setValue(initialLevel);
  (void)lampLevel.changedValueOrNull();

  analogWrite(lampPin, 128);

  randomSeed(analogRead(0));
}

void loop(void) {
  adapter->update();
  bool on = lampOn.getValue().boolean;
  if (on) {
    int level = map(lampLevel.getValue().number, 0, 100, 255, 0);
    analogWrite(lampPin, level);
  } else {
    analogWrite(lampPin, 255);
  }

  if (lastOn != on) {
    lastOn = on;
  }
}

void do_fade(const JsonVariant &input) {
  JsonObject inputObj = input.as<JsonObject>();
  long long int duration = inputObj["duration"];
  long long int brightness = inputObj["brightness"];

  delay(duration);

  ThingDataValue value = {.integer = brightness};
  lampLevel.setValue(value);
  int level = map(brightness, 0, 100, 255, 0);
  analogWrite(lampPin, level);

  ThingDataValue val;
  val.number = 102;
  ThingEventObject *ev = new ThingEventObject("overheated", NUMBER, val);
  lamp.queueEventObject(ev);
}

ThingActionObject *action_generator(DynamicJsonDocument *input) {
  return new ThingActionObject("fade", input, do_fade, nullptr);
}

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