Questions with regards to ESP8266 Basic and hardware interfacing and control via Basic commands

Moderator: Mmiscool

User avatar
By ptribbey
#71282 Hi,
Wondering if anyone knows for sure if the Wemos mini D1 has problems with pin assignments or other hardware issues in 8266basic.
I am getting strange results, where an esp board works fine.
The basic interpreter is running okay, just wont do a dht22 on pin 4 for instance, where the parts are known to be good.
Thanks
Paul

**edit** I was using the wrong pin numbers.
on a d1 mini, pin4 is gpio2 and pin3 is gpio0 etc.
It works great once I fixed that.
This is Rotohammers thermostat code adapted for a wemos d1 mini and a dht22.

Code: Select all'WeMos D1 mini, dht22 and Relay shield
memclear
SERIALPRINTLN "restart page"
cls

let curr = 0
let setp = 25
let stat = Off
dht.setup(22,2)
Print "WeMos WiFi Thermostat "
print
Button "Setpoint", [refresh]
textbox setp
wprint "CurrTemp="
textbox curr
wprint "<br>"
wprint "Heater="
textbox stat
wprint "<br>"
button "Exit", [quit]
timer 4000, [refresh]
wait

[on0]
io(po,0,1)
SERIALPRINTLN "PIN 0 ON"
let stat = "On"
Wait

[off0]
io(po,0,0)
SERIALPRINTLN "PIN 0 OFF"
let stat = "Off"
Wait


[refresh]
curr = dht.temp()
'curr=31
SERIALPRINTLN curr
if curr < setp then goto [on0] else goto [off0]
Wait

[quit]
timer 0
wprint "<a href='/'>Menu</a>"
end