Report Bugs Here

Moderator: Mmiscool

User avatar
By Mmiscool
#47314 I tested your program and it seems to run as intended.

I then modified as shown below adding the status print to before the buttons so that it can be seen.

The button changes on each click from on to off and my led turns on and off. Are you sure you have the right pin number?

Code: Select alllet pin = d4
let pinstatus = 1
po pin pinstatus

[home]
cls
print pinstatus
if pinstatus == 0 then imagebutton "routerOFF.jpg" [toggle]
if pinstatus == 1 then imagebutton "routerON.jpg" [toggle]
wait

[toggle]
if pinstatus == 0 then pinstatus = 1 else pinstatus = 0
po pin pinstatus
goto [home]
User avatar
By Electroguard
#47319 This is very weird. I have always been using the blue onboard gpio01 led which I define and address as pin1... as per the available pins on the right-hand side of the VARS page.

But because you asked me if I'm sure I'm using the right pin, I used your modified code which is changed for D4, and for me it bombs straight out with an error because it will not accept D4 as a usable pin for me. I don't even know what the D prefix is supposed to signify, but it doesn't work for me.

So I changed your modified code for my pin 1, and the program doesn't then bomb with an error, and the blue led can be turned on and off, but not by clicking on the imagebutton picture, cos that does not do anything other than repaint the same picture, nor does your added status print change from 1. The imagebutton simply does not branch for me.
The same script runs completely differently for us - and I have tried it on another module with exactly the same results. I was wondering if it might have been something to do with how our different browsers manage javascript or something, but that doesn't explain why you needed to change the led pin1 to D4 in the first place, nor why D4 causes the same program to exit with an error for me but not you.

Why did you need to change pin1 to D4?
Is there something relevant about D4 and the ESPs onboard blue gpio01 led that I'm not aware of?
Why do any gpio pins need to be prefixed with D ?

The only conclusive test I can think of is if CiccioCB could try it if he gets a chance (he has the same Ser Dev Kit Module as me), and see whether it works for him?
User avatar
By Mmiscool
#47327 Are you sure you are on the latest version of the firmware. This seems real weird. I jave a node mcu dev kit. The node mcu labes the pins diferently. Using the d# matched the pin mapping on the board.

If you go to the setting page is it the version right? Are you using chrome. Every thing is iptimised for chrome and web kit based browsers such as safari and the android native web browser.
User avatar
By Electroguard
#47343 I am using Alpha 24.
I've been trying to use the nodeMCU hardware that you use, but I've reformatted and reflashed my nodeMCU device 5 times with Alpha24 and afterwards get a timeout error every time I try to access 192.168.4.1/edit. I have flashed it with previous versions and had it working, but there's not much more I can try with it now if I can't get it to load a script.

I did not know Chrome was a requirement so have always been using Firefox because they are an indepent without an omnipotent commercial axe to grind like Google and Microsoft... but I will try to set up another machine just for ESP_Basic use with chrome, then see if I can use the nodeMCU with that. It will take me at least a couple of days to do though.