Ejemplo n.º 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})
Ejemplo n.º 2
0
def said_hello():
    iot.say("Hello. ")
Ejemplo n.º 3
0
def said_How_are_you():
    iot.say("I'm good. Thank you for asking ")
Ejemplo n.º 4
0
def said_right():
    iot.publish("messages","right")
    iot.say("Asking the car to move right")
Ejemplo n.º 5
0
def said_left():
    iot.publish("messages","left")
    iot.say("Asking the car to move left")
Ejemplo n.º 6
0
def said_back():
    iot.publish("messages","back")
    iot.say("Asking the car to move backward")
Ejemplo n.º 7
0
def full_speed():
    iot.say("OK, turning the fan on")
    iot.publish("tuuletin","full")
Ejemplo n.º 8
0
def new_message(message):
    iot.say(message)
Ejemplo n.º 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")
Ejemplo n.º 14
0
def said_forward():
    iot.publish("messages", "sparkle")
    iot.say("OK, sparkle")
Ejemplo n.º 15
0
def said_hello():
    iot.say("Hi there, I am shining.")
Ejemplo n.º 16
0
def said_forward():
    iot.publish("messages","forward")
    iot.say("Asking the car to move forward")
Ejemplo n.º 17
0
def testi(message):
    print(message)
    distance = float(message)
    if distance < 20.0:
        iot.say("Obstacle warning!")
        time.sleep(4)
Ejemplo n.º 18
0
def off():
    iot.say("OK, turning the fan off")
    iot.publish("tuuletin","off")