Пример #1
0
def take_pic():
    iot.say("Taking a selfie!")
    with picamera.PiCamera():
        with open("image.jpg", 'wb') as capture_file:
            camera.hflip = True # kaanna vaaka-akselin suhteen
            camera.vflip = True # peilikuva
            camera.resolution = (1296, 972)
            camera.capture(capture_file)
    
    with open(filename, 'rb') as capture_file:
        url = TG_URL + '/sendPhoto'
        files = {"photo": capture_file}
        res = requests.post(url, files=files, params={'chat_id': GROUP_ID})
Пример #2
0
def said_hello():
    iot.say("Hello. ")
Пример #3
0
def said_How_are_you():
    iot.say("I'm good. Thank you for asking ")
Пример #4
0
def said_right():
    iot.publish("messages","right")
    iot.say("Asking the car to move right")
Пример #5
0
def said_left():
    iot.publish("messages","left")
    iot.say("Asking the car to move left")
Пример #6
0
def said_back():
    iot.publish("messages","back")
    iot.say("Asking the car to move backward")
Пример #7
0
def full_speed():
    iot.say("OK, turning the fan on")
    iot.publish("tuuletin","full")
Пример #8
0
def new_message(message):
    iot.say(message)
Пример #9
0
def half_speed():
    iot.say("OK, turning the fan off")
    iot.publish("tuuletin","half")
def cycle():
    print("lähetettiin komento e")
    iot.say("Deploying wipe")
    ser.write(b"e")
    iot.publish("messages", "green")
def bounce():
    print("lähetettiin komento c")
    iot.say("Deploying bounce")
    ser.write(b"c")
    iot.publish("messages", "green")
def rainbow_cycle():
    print("lähetettiin komento b")
    iot.say("Deploying rainbow cycle")
    ser.write(b"b")
def red_led():
    ser.write(b"a")
    print("lähetettiin komento a")
    iot.say("Deploying red LED")
Пример #14
0
def said_forward():
    iot.publish("messages", "sparkle")
    iot.say("OK, sparkle")
Пример #15
0
def said_hello():
    iot.say("Hi there, I am shining.")
Пример #16
0
def said_forward():
    iot.publish("messages","forward")
    iot.say("Asking the car to move forward")
Пример #17
0
def testi(message):
    print(message)
    distance = float(message)
    if distance < 20.0:
        iot.say("Obstacle warning!")
        time.sleep(4)
Пример #18
0
def off():
    iot.say("OK, turning the fan off")
    iot.publish("tuuletin","off")