barking = db.get_button_state() # client.publish('dog/activity', payload='button') # client.publish('dog/activity', status[0]) status = { 'name': pset.dog_name, 'location_long': pset.dog_location_long, 'location_lat': pset.dog_location_lat, 'acceleration': betrag, 'barking': barking[0], 'temp': temp } # print(status) # publish_values('dog/status', status) # promt user with a 'beeep' ps.beep(50, 2000) # 200ms beep 1kHz ticks = time.time() w, x, y, z = imu.get_quaternion() beschleunigung = 0.0 # SEND STATUS if time.time() > ticks_status + 1.0: temp = imu.get_temperature() w, x, y, z = imu.get_quaternion() barking = db.get_button_state() status = { 'name': pset.dog_name, 'location_long': pset.dog_location_long, 'location_lat': pset.dog_location_lat, 'acceleration': betrag,
#!/usr/bin/env python # -*- coding: utf-8 -*- HOST = "localhost" PORT = 4223 UID = "XYZ" # Change XYZ to the UID of your Piezo Speaker Bricklet from tinkerforge.ip_connection import IPConnection from tinkerforge.bricklet_piezo_speaker import BrickletPiezoSpeaker if __name__ == "__main__": ipcon = IPConnection() # Create IP connection ps = BrickletPiezoSpeaker(UID, ipcon) # Create device object ipcon.connect(HOST, PORT) # Connect to brickd # Don't use device before ipcon is connected # Make 2 second beep with a frequency of 1kHz ps.beep(2000, 1000) raw_input("Press key to exit\n") # Use input() in Python 3 ipcon.disconnect()