-->
Page 4 of 4

Re: GPIO and PWM with GUI

PostPosted: Fri Feb 03, 2017 7:58 am
by Electroguard
I seem to remember someone asking if a slider value could be read and actioned without needing to press a 'read' button.

The answer is 'yes' if using a timer, as shown in the attached script.
Note that the new value only gets read when the slider is released.
Code: Select allcls
let pinNo = 1
let Brightness = 512
print "Control PIN"
textbox pinNo
print " Brightness"
textbox Brightness
slider Brightness,0,1024
timer 200,[SetBrightness]
'button " Set Brightness",[SetBrightness]
button " Exit ", [TestExit]
wait

[SetBrightness]
io(pwo,pinNo,Brightness)
wait

[TestExit]
end     

Easy SERVO tester... was "GPIO and PWM with GUI"

PostPosted: Fri Feb 03, 2017 9:07 am
by heckler
Thanks Electroguard (and Mike)

With a few simple changes to your example we now have an awesome SERVO tester...

Code: Select allcls
let pinNo = 2
let Servo = 90
print "Control PIN"
textbox pinNo
print " Servo"
textbox Servo
slider Servo,0,180
timer 200, [SetServo]
'button " Set Servo", [SetServo]
button " Exit ", [TestExit]
wait

[SetServo]
io(servo,pinNo,Servo)
wait

[TestExit]
end     

' See more at: http://www.esp8266.com/viewtopic.php?f=40&t=4849&start=12#sthash.zNjuKBPy.dpuf


I am continually astonished and amazed at how easy it is to implement code with Mike's espBASIC !!! :D :mrgreen:

For me there is simply NOTHING else that compares.
dwight