Hi,
I'm doing a Project in which I want to control a Car over WIFI.
Does anyone know how to Program a Script in which there are buttons for Forward, Backwards,Left and Right. It is also important that I can watch a Stream from a camera which i mounted on top of the car.
I can open the Stream in Safari so I think it might be possible with load_url in a UI.WebView but I just cant figure out the Code.
Is there anyone that knows how to program such a thing?
This is the code I figured it out myself. But I just don't understand how to do the camera thing.
I'm a total beginner to so that doesn't makes it more simple.
from scene import *
import sound
import random
import math
import webbrowser
A = Action
class MyScene (Scene):
def setup(self):
self.buttonl = SpriteNode('iob:arrow_left_b_256')
self.buttonl.position = (70, 150)
self.buttonl.scale = 0.7
self.add_child(self.buttonl)
self.buttonr = SpriteNode('iob:arrow_right_b_256')
self.buttonr.position = (300, 150)
self.buttonr.scale = 0.7
self.add_child(self.buttonr)
self.buttonf = SpriteNode('iob:arrow_up_b_256')
self.buttonf.position = (185, 300)
self.buttonf.scale = 0.7
self.add_child(self.buttonf)
self.buttonh = SpriteNode('iob:arrow_down_b_256')
self.buttonh.position = (70, 400)
self.buttonh.scale = 0.7
self.add_child(self.buttonh)
self.buttons = SpriteNode('iob:close_circled_256')
self.buttons.position = (310, 410)
self.buttons.scale = 0.5
self.add_child(self.buttons)
def did_change_size(self):
pass
def touch_began(self, touch):
for touch in self.touches.values():
if touch.location in self.buttonl.bbox:
webbrowser.open("http://192.168.1.160/links")
print("links")
if touch.location in self.buttonr.bbox:
webbrowser.open("http://192.168.1.160/rechts")
print("rechts")
if touch.location in self.buttonf.bbox:
webbrowser.open("http://192.168.1.160/forne")
print("forne")
if touch.location in self.buttons.bbox:
webbrowser.open("http://192.168.1.160/stop")
print("stop")
if touch.location in self.buttonh.bbox:
webbrowser.open("http://192.168.1.160/zuruck")
print("zurück")
def touch_moved(self, touch):
pass
def touch_ended(self, touch):
webbrowser.open("http://192.168.1.160/stop")
if _name_ == '_main_':
run(MyScene(), show_fps=False)