-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
73 lines (54 loc) · 1.85 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
from lib.mBot import *
import sys
import kivy
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.button import Button
from kivy.uix.textinput import TextInput
from kivy.uix.gridlayout import GridLayout
def reset(lol):
if lol == True:
man = True
def best():
def light(r, b, g):
bot = mBot()
bot.startWithSerial('COM3')
while True:
bot.doRGBLedOnBoard(0, r, b, g)
# Replace this with your
# current version
kivy.require('1.11.1')
class Layout(GridLayout):
def __init__(self, **kwargs):
super(Layout, self).__init__(**kwargs)
self.rows = 2
self.red = TextInput(multiline=False)
self.add_widget(self.red)
self.red.text = '250'
self.green = TextInput(multiline=False)
self.add_widget(self.green)
self.green.text = '0'
self.blue = TextInput(multiline=False)
self.add_widget(self.blue)
self.blue.text = '0'
self.stat = Label(text="R=0 G=0 B=0")
self.add_widget(self.stat)
self.up = Button(text="Update LED Lights !", font_size=35)
self.up.bind(on_press=self.upd)
self.add_widget(self.up)
self.err = Label(text="Error Display")
self.add_widget(self.err)
def upd(self, instance):
redi = int(self.red.text)
greeni = int(self.green.text)
bluei = int(self.blue.text)
light(redi, greeni, bluei)
reset(True)
# Defining a class
class MBotLedSettings(App):
def build(self):
l = Layout()
return l
if __name__ == "__main__":
MBotLedSettings().run()
best()