This is the driver example for the basic hardware version configuration:
'write("starttimer",10)
cls
'VCNT GPIO pin
let pinNo = 13
'ON-OFF GPIO pin
let off = 16
io(po,off,0)
' Software option for Light FULL ON at power-up
' working only when the hardware ON-OFF function is activated
'stat = "on"
'let sw = 0
' Software option for Light FULL OFF at power-up
' working only when the hardware ON-OFF function is activated
stat = "off"
let sw = 1
let b1 = 800
let b2 = 850
let b3 = 890
let b4 = 550
let b5 = 650
let b6 = 750
let b7 = 850
wprint " <b>MPDMv7 - MAINS AC Dimmer Dev Board <br>demo driver</b><br><i>by tech@esp8266-projects.com</i><br><br> "
t = 0
timer 300, [start]
print "Control PIN"
textbox pinNo
wprint "<br>"
wprint "<br>"
wprint " Brightness"
textbox b1
button " Set Brightness ",[Setb1]
wprint "<br>"
wprint " Brightness"
textbox b2
button " Set Brightness ",[Setb2]
wprint "<br>"
wprint " Brightness"
textbox b3
button " Set Brightness ",[Setb3]
wprint "<br>"
wprint " Brightness"
textbox b4
button " Set Brightness ",[Setb4]
wprint "<br>"
wprint " Brightness"
textbox b5
button " Set Brightness ",[Setb5]
wprint "<br>"
wprint " Brightness"
textbox b6
button " Set Brightness ",[Setb6]
wprint "<br>"
wprint " Brightness"
textbox b7
button " Set Brightness ",[Setb7]
wprint "<br>"
wprint "<br>"
textbox stat
button " ON/OFF ",[off]
wprint "<i><t> -> Press first for hardware ON/OFF function !!</i><br>"
button " Exit ", [TestExit]
wait
[start]
io(po,2,0)
delay 100
io(po,2,1)
t = t + 1
if t = 5 then
timer 0
end if
wait
[off]
if sw = 0 then
stat = "off"
sw = 1
io(po,off,0)
else
stat = "on"
sw = 0
io(po,off,1)
endif
wait
[Setb1]
io(pwo,pinNo,b1)
wait
[Setb2]
io(pwo,pinNo,b2)
wait
[Setb3]
io(pwo,pinNo,b3)
wait
[Setb4]
io(pwo,pinNo,b4)
wait
[Setb5]
io(pwo,pinNo,b5)
wait
[Setb6]
io(pwo,pinNo,b6)
wait
[Setb7]
io(pwo,pinNo,b7)
wait
[TestExit]
Wprint | <br><br><a href="./edit"> Click here to go to <b>Edit</b> </a> |
end
Original Article: http://esp8266-projects.org/2017/11/ac-dimmer-devboard-mpdmv7-5-part-2/
Happy breadboarding,
TJ.
Available on Tindie: https://www.tindie.com/products/nEXT_EVO1/universal-ac-mains-dimmer-mpdmv41/