device.update_circle(
    id=id,
    movements={
        'repeat': 2,
        'movements': [
            {
                'movement': 'relative',
                'direction': [1, 0],
                'distance': 10,
                'speed': speed
            },
            {
                'movement': 'relative',
                'direction': [0, 1],
                'speed': speed,
                'time_span': 0.5
            },
            {
                'movement': 'relative',
                'direction': [-1, 0],
                'distance': 10,
                'speed': speed
            }, {
                'movement': 'relative',
                'direction': [0, -1],
                'time_span': 0.5,
                'speed': speed
            }
        ]
    }
)
Пример #2
0
from smartphone_connector import Connector, AccMsg, KeyMsg, Colors
from random import randint
from examples.server_address import SERVER_ADDRESS

device = Connector(SERVER_ADDRESS, 'FooBar')
device.clear_playground()

id = device.add_circle(pos_x=0, pos_y=0, radius=5, color=Colors.RED)

device.sleep(3)

speed = 3

device.update_circle(id=id,
                     movements={
                         'repeat':
                         10,
                         'movements': [{
                             'movement': 'relative',
                             'direction': [0, 1],
                             'distance': 50,
                             'speed': speed
                         }, {
                             'movement': 'relative',
                             'direction': [0, -1],
                             'distance': 50,
                             'speed': speed
                         }]
                     })
device.set_timeout(lambda x: device.update_circle(id=id, pos_x=-50), time=2)
Пример #3
0
                x2=0,
                y2=RADIUS - 5,
                color='red',
                line_width=0.5)
device.add_circle(
    id='circle',
    radius=2,
    pos_x=0,
    pos_y=RADIUS - 7,
    color='red',
)

hours = int(device.input("Uhrzeit: Stunden", input_type="number"))

device.update_line(id='hour',
                   x2=sin(radians(30 * hours)) * (RADIUS - 10),
                   y2=cos(radians(30 * hours)) * (RADIUS - 10))
minutes = int(device.input("Uhrzeit: Stunden", input_type="number"))
device.update_line(id='minute',
                   x2=sin(radians(6 * minutes)) * (RADIUS - 7),
                   y2=cos(radians(6 * minutes)) * (RADIUS - 7))
seconds = int(device.input("Uhrzeit: Stunden", input_type="number"))
seconds = 17
device.update_line(id='seconds',
                   x2=sin(radians(6 * seconds)) * (RADIUS - 5),
                   y2=cos(radians(6 * seconds)) * (RADIUS - 5))
device.update_circle(id='circle',
                     pos_x=sin(radians(6 * seconds)) * (RADIUS - 7),
                     pos_y=cos(radians(6 * seconds)) * (RADIUS - 7))
device.disconnect()
Пример #4
0
device.sleep(3)

speed = 10

device.update_circle(id=id,
                     movements={
                         'repeat':
                         2,
                         'movements': [{
                             'movement': 'absolute',
                             'to': [40, 0],
                             'speed': speed
                         }, {
                             'movement': 'absolute',
                             'to': [40, 40],
                             'speed': speed
                         }, {
                             'movement': 'absolute',
                             'to': [-40, -40],
                             'speed': speed
                         }, {
                             'movement': 'absolute',
                             'to': [0, 0],
                             'speed': speed
                         }]
                     })
device.sleep(1)

time = 1
device.update_circle(id=id,
                     movements={