'title$ = "Virtual Joystick"joy$ = "C"jsexternal "/joy_cb.min.js"
rate = 30 ' rate between each picture sample (msec)'pause 100' set the max resolution in terms of memoryif camera.setup(10) = 0 then end
print camera.params("vflip", 1)print camera.params("hmirror", 1)
'set at 800x600print camera.params("framesize", 4)
speed = 20leftservo =295rightservo = 307leftcenter = 300rightcenter =307PWM.SETUP 13, 1, leftcenter, 50, 12PWM.SETUP 12, 2, rightcenter, 50, 12
onHtmlReload setpage
gosub setpage
'onHtmlChange input_check
wait
setpage:
clsa$ = ""a$ = a$ + |<h2>AnnexCAM Demo mini</h2> |a$ = a$ + |<img id='camera' src="picture" style=width:25%;height:auto;">|
a$ = a$ + "<br><br>"'a$=a$ + |<div style='display: table; margin-right: auto; margin-left: auto;'>| + textbox$(title$,"t") + |</div>|+"<br>"a$=a$ + |<div style='display: table; margin-right: auto; margin-left: auto;'>|a$=a$ + |<div id="joyDiv" style="width:200px;height:200px;margin-bottom:20px;margin:10px"></div>|a$=a$ + |<br><div style="display: table; margin-right: auto; margin-left: auto;">| + textbox$(joy$,"t") + |</div>|a$=a$ + cssid$("t","text-align:center;border-style: none;")autorefresh 100html a$
a$ = |joy = new JoyStick('joyDiv');|a$ = a$ + |joy.SetCallback(function(e) {connection.send('cmd:immediatxJOY$="' + e.GetDir() + '":HtmlEventVar$="joy$"\n' )});|jscript a$a$ = ""
jscall "set_pictimer(" + str$(rate) + ");"
return 'setpage
input_check:if joy$ = "N" thenPWM.out 1, leftcenter - speedpwm.out 2, rightcenter + speedend if 'Nord 'joystick activity returns directions directly into joy$ textbox
if joy$ = "S" thenPWM.out 1, leftcenter + speedpwm.out 2, rightcenter - speedend if
if joy$ = "E" thenPWM.out 1, leftcenter - speedpwm.out 2, rightcenter - speedend if
if joy$ = "W" thenPWM.out 1, leftcenter + speedpwm.out 2, rightcenter + speedend if
if joy$ = "C" thenPWM.out 1, leftcenterpwm.out 2, rightcenterend if 'Nord
return 'input_check
--
You received this message because you are subscribed to the Google Groups "Annex WiFi RDS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to annex_wifi_rd...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/annex_wifi_rds/13ccd9f9-0582-475a-b53e-e8cb2dd0f813o%40googlegroups.com.
Code hier eingeben...rate = 30 ' rate between each picture sample (msec)