For a more detailed description please take a look at the Part 1: MPDMv7.5 AC Dimmer devboard overview

MPDMv7.5 AC Dimmer devboard ESP Basic program example for the Extra DAC version configuration:

address = 96 'MPC4726 DAC I2C Address
cls
i2c.setup(4,5) 'choose your I2C bus pins
 
let off = 16

io(po,off,0)

'stat = "on"
'let sw = 0
stat = "off"
let sw = 1

let cv = 2.5

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 "DAC Control" 
wprint "<br>"
wprint "<br>"
'wprint " Brightness" 
textbox cv 
button " Set Brightness ",[Setb1] 
wprint " (0 to 2.85V) <br>"
wprint "<br>"
textbox stat
button " ON/OFF ",[off] 
wprint "<i>-> If not working check SJ1 or SJ5 for hardware ON/OFF function!!</i><br>"
wprint "<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] 
cmdv = (4096*cv)/3.295
cmdh = cmdv >> 8 
cmdl = cmdv - ( cmdh << 8 )

i2c.begin(address)
i2c.write(cmdh)
i2c.write(cmdl)
i2c.end()
wait

[TestExit] 
Wprint | <br><br><a href="./edit"> Click here to go to <b>Edit</b> </a> |
end 

 


Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

AC Dimmer

AC Dimmer DevBoard – MPDMv7.5 – Part 2

For a more detailed description please take a look at the Part 1: MPDMv7.5 AC Dimmer devboard overview MPDMv7.5 AC Dimmer devboard ESP Basic program example for the basic version configuration: 'write("starttimer",10) cls 'VCNT GPIO Read more…

AC Dimmer

AC Dimmer DevBoard – MPDMv7.5 Release!

For any new orders/requests please feel free to use as usual: tech at esp8266-projects.com. MPDMv7.5 Boards are also available on Tindie: AC MAINS Dimmer – MPDMv7.5 ————————————————— DISCLAIMER ————————————————–       WARNING!! You will Read more…

AC Dimmer

MPDMv4 – Arduino Mega Driver example

For any new orders/requests please feel free to use as usual: tech at esp8266-projects.com. MPDMv4 Boards are also available on Tindie: AC MAINS Dimmer – MPDMv4 ————————————————— DISCLAIMER ————————————————–       WARNING!! You will Read more…