You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ARDUINO IDE: 1.8.10 (32bit)
Elk Library: release 0.0.16 (Installed manually into Arduino IDE library folder)
ESP8266 BOARD: 2.5.2 (Installed with board manager from Arduino IDE)
Arduino Boards: 1.8.1 (Installed with board manager from Arduino IDE)
ESP32 Board: 1.0.4 (Installed with board manager from Arduino IDE)
Test Code
#include "elk.h" // Add Elk library
extern "C" void myDelay(int milli) {
delay(milli);
}
extern "C" void myWrite(int pin, int val) {
digitalWrite(pin, val);
}
extern "C" void myMode(int pin, int mode) {
pinMode(pin, mode);
}
struct js *js;
void setup() {
Serial.begin(115200);
Serial.println();
js = js_create(malloc(700), 700);
Serial.println("malloc done");
js_import(js, "delay", (uintptr_t) myDelay, "vi");
js_import(js, "digitalWrite", (uintptr_t) myWrite, "vii");
js_import(js, "pinMode", (uintptr_t) myMode, "vii");
Serial.println("imports done");
js_eval(js, "let pin = 2;", 0); // <--- HERE IS THE PROBLEM ON ESP8266 & AVR
js_eval(js, "pinMode(2, 1);", 0); // Set LED pin to OUTPUT mode ... on esp32 set to (pin, 2)
js_eval(js, "let loop = function() { delay(200); digitalWrite(2, 1); delay(200); digitalWrite(2, 0); };", 0);
Serial.println("ready ... looping");
}
void loop() {
js_eval(js, "loop();", 0);
Serial.println(" ... looping");
}
This functions as expected on the esp32 platform ... and when I eliminate the variable from the digitalWrite function calls and remark-out the "let pin = 2" js_eval call ... everything works as expected on the esp8266 & arv platforms ... so it's defiantly the "let pin = 2;" variable setting call that's causing things to bork on the esp8266 & avr platforms ...
UPDATE: on the avr platform it reboots ... on the esp8266 it ignores any js_evals after the "let pin = 2" call ... update update ... if I don't try to access the variable ... no reboot happens ... but still doesn't function ... just setting the variable causes it to fail ...
The text was updated successfully, but these errors were encountered:
sfranzyshen
changed the title
ESP8266 under the Arduino IDE fails when setting a variable
ESP8266 & AVR under the Arduino IDE fails when setting a variable
Nov 28, 2019
LINUX_DIST="Linux Mint 18.3 Sylvia MATE 32-bit"
KERNEL=Linux computer 4.10.0-38-generic i686 i686 i686 GNU/Linux
ARDUINO IDE: 1.8.10 (32bit)
Elk Library: release 0.0.16 (Installed manually into Arduino IDE library folder)
ESP8266 BOARD: 2.5.2 (Installed with board manager from Arduino IDE)
Arduino Boards: 1.8.1 (Installed with board manager from Arduino IDE)
ESP32 Board: 1.0.4 (Installed with board manager from Arduino IDE)
Test Code
This functions as expected on the esp32 platform ... and when I eliminate the variable from the digitalWrite function calls and remark-out the "let pin = 2" js_eval call ... everything works as expected on the esp8266 & arv platforms ... so it's defiantly the "let pin = 2;" variable setting call that's causing things to bork on the esp8266 & avr platforms ...
UPDATE: on the avr platform it reboots ... on the esp8266 it ignores any js_evals after the "let pin = 2" call ... update update ... if I don't try to access the variable ... no reboot happens ... but still doesn't function ... just setting the variable causes it to fail ...
The text was updated successfully, but these errors were encountered: