Hallo, guten Tag.
Ich habe in meinem Programm einen Timer eingebaut der regelmäßig eine Proc ausführt um Daten von einem Roboter abzufragen (Hindernissensor) und in einer Pic darstellt. Es funktioniert auch soweit. Nur wenn ich ein Button drücke , kommt der Buttondruck nicht beim ersten mal , sondern ich muss mehrmals drauf drücken damit eine Reaktion kommt. Es wirkt sich aus, wenn der Roboter sofort anhalten soll, es kommt mit verzögerung.
Wie kann man bitte den Timer verfeinern? Oder gibt es noch eine andere Weise um eine Proc Regelmäßig abzufragen?
Danke.
Gruss
Alles anzeigen
Ich habe in meinem Programm einen Timer eingebaut der regelmäßig eine Proc ausführt um Daten von einem Roboter abzufragen (Hindernissensor) und in einer Pic darstellt. Es funktioniert auch soweit. Nur wenn ich ein Button drücke , kommt der Buttondruck nicht beim ersten mal , sondern ich muss mehrmals drauf drücken damit eine Reaktion kommt. Es wirkt sich aus, wenn der Roboter sofort anhalten soll, es kommt mit verzögerung.
Wie kann man bitte den Timer verfeinern? Oder gibt es noch eine andere Weise um eine Proc Regelmäßig abzufragen?
Danke.
Gruss
Quellcode
- $MAKE CLE
- declare url$,urlpart$
- declare b_vor&,b_zur&
- declare b_links&,b_hlinks&,b_mitte&,b_hrechts&,b_rechts&
- declare b_v0&,b_v1&,b_v2&
- declare b_ser0&,b_ser1&,b_sharp&,b_ton&
- declare b_cls&
- declare ende&,test&,win&
- Window 20,20-400,400
- win&=create("window",%HWnd,"test",420,20,300,420)
- SetTimer 100
- b_vor& = Create("Button",win&,"vor", 10, 20, 80, 24)
- b_zur& = Create("Button",win&,"zurück", 10, 45, 80, 24)
- b_links& = Create("Button",win&,"links", 10, 70, 80, 24)
- b_hlinks& = Create("Button",win&,"hlinks", 10, 95, 80, 24)
- b_mitte& = Create("Button",win&,"mitte", 10, 120, 80, 24)
- b_hrechts& = Create("Button",win&,"hrechts", 10, 145, 80, 24)
- b_rechts& = Create("Button",win&,"rechts", 10, 170, 80, 24)
- b_v0& = Create("Button",win&,"v0", 10, 195, 80, 24)
- b_v1& = Create("Button",win&,"v1", 10, 220, 80, 24)
- b_v2& = Create("Button",win&,"v2", 10, 245, 80, 24)
- b_ser0& = Create("Button",win&,"ser0", 10, 270, 80, 24)
- b_ser1& = Create("Button",win&,"ser1", 10, 295, 80, 24)
- b_sharp& = Create("Button",win&,"sharp", 10, 320, 80, 24)
- b_ton& = Create("Button",win&,"ton", 10, 345, 80, 24)
- b_cls& = Create("Button",win&,"cls", 220, 20, 40, 24)
- ende&=1
- While ende&
- WaitInput
- Case %wmTimer : TimerProc
- If Clicked(b_vor&)
- urlpart$="vor"
- test&=1
- EndIf
- If Clicked(b_zur&)
- urlpart$="zur"
- test&=1
- EndIf
- If Clicked(b_links&)
- urlpart$="links"
- test&=1
- EndIf
- If Clicked(b_hlinks&)
- urlpart$="hlinks"
- test&=1
- EndIf
- If Clicked(b_mitte&)
- urlpart$="mitte"
- test&=1
- EndIf
- If Clicked(b_hrechts&)
- urlpart$="hrechts"
- test&=1
- EndIf
- If Clicked(b_rechts&)
- urlpart$="rechts"
- test&=1
- EndIf
- If Clicked(b_v0&)
- urlpart$="v0"
- test&=1
- EndIf
- If Clicked(b_v1&)
- urlpart$="v1"
- test&=1
- EndIf
- If Clicked(b_v2&)
- urlpart$="v2"
- test&=1
- EndIf
- If Clicked(b_ser0&)
- urlpart$="ser0"
- test&=1
- EndIf
- If Clicked(b_ser1&)
- urlpart$="ser1"
- test&=1
- EndIf
- If Clicked(b_sharp&)
- urlpart$="sharp"
- test&=1
- EndIf
- If Clicked(b_ton&)
- urlpart$="ton"
- test&=1
- EndIf
- If Clicked(b_cls&)
- leere
- EndIf
- endwhile
- killtimer
- end
- proc leere
- cls
- endproc
- proc TimerProc
- if test&=1
- downloadfile("http://192.168.2.101/?pin="+urlpart$)
- test&=0
- else
- downloadfile("http://192.168.2.101/?pin=leer")
- endif
- while %Loading
- waitinput 100
- endwhile
- print str$(ord($download))
- endproc