with ESP8266Basic.
On my blog you can also find a test of KY-006 with Arduino.
Hardware
Pin S ESP8266 Pin 5
Pin (middle) not connected
Pin - GND ESP8266 Ground
' Test KY006
cls
PinBuz = 5
pwBuz = 0
pwBuzMax = 500
html | <h1>Test KY006 Buzzer</h1> |
html | <table> |
html | <tr><td> |
button "0", [SetPinBuz0]
html | </td><td> |
slider pwBuz , 0 , pwBuzMax
html | </td><td> |
button "Max", [SetPinBuzMax]
html | </td></tr><tr><td> |
button "SetSliders" , [SetSliders]
html | </td><td><center> |
button "SlidersMid" , [SetPinBuzMid]
html | </center></td><td> |
button " Exit ", [Exit]
html | </td></tr></table> |
wait
[SetPinBuz0]
pwBuz = 0
Goto [SetSliders]
[SetPinBuzMid]
pwBuz = pwBuzMax / 2
Goto [SetSliders]
[SetPinBuzMax]
pwBuz = pwBuzMax
Goto [SetSliders]
[SetSliders]
io(pwo,PinBuz,pwBuz)
wait
[Exit]
end
Pin S ESP8266 Pin 5
Pin (middle) not connected
Pin - GND ESP8266 Ground
' Test KY006
cls
PinBuz = 5
pwBuz = 0
pwBuzMax = 500
html | <h1>Test KY006 Buzzer</h1> |
html | <table> |
html | <tr><td> |
button "0", [SetPinBuz0]
html | </td><td> |
slider pwBuz , 0 , pwBuzMax
html | </td><td> |
button "Max", [SetPinBuzMax]
html | </td></tr><tr><td> |
button "SetSliders" , [SetSliders]
html | </td><td><center> |
button "SlidersMid" , [SetPinBuzMid]
html | </center></td><td> |
button " Exit ", [Exit]
html | </td></tr></table> |
wait
[SetPinBuz0]
pwBuz = 0
Goto [SetSliders]
[SetPinBuzMid]
pwBuz = pwBuzMax / 2
Goto [SetSliders]
[SetPinBuzMax]
pwBuz = pwBuzMax
Goto [SetSliders]
[SetSliders]
io(pwo,PinBuz,pwBuz)
wait
[Exit]
end
No comments:
Post a Comment