Esempio n. 1
0
 def get_sound(self):
     try:
         si = BrickletSoundIntensity(self.SOUND_UID, self.ipcon)
         self.ipcon.connect(self.HOST, self.PORT)
         intensity = si.get_intensity()
         self.ipcon.disconnect()
         return float(intensity)
     except:
         return None
Esempio n. 2
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

HOST = "localhost"
PORT = 4223
UID = "XYZ"  # Change XYZ to the UID of your Sound Intensity Bricklet

from tinkerforge.ip_connection import IPConnection
from tinkerforge.bricklet_sound_intensity import BrickletSoundIntensity

if __name__ == "__main__":
    ipcon = IPConnection()  # Create IP connection
    si = BrickletSoundIntensity(UID, ipcon)  # Create device object

    ipcon.connect(HOST, PORT)  # Connect to brickd
    # Don't use device before ipcon is connected

    # Get current intensity
    intensity = si.get_intensity()
    print("Intensity: " + str(intensity))

    raw_input("Press key to exit\n")  # Use input() in Python 3
    ipcon.disconnect()
#!/usr/bin/env python
# -*- coding: utf-8 -*-

HOST = "localhost"
PORT = 4223
UID = "XYZ" # Change XYZ to the UID of your Sound Intensity Bricklet

from tinkerforge.ip_connection import IPConnection
from tinkerforge.bricklet_sound_intensity import BrickletSoundIntensity

if __name__ == "__main__":
    ipcon = IPConnection() # Create IP connection
    si = BrickletSoundIntensity(UID, ipcon) # Create device object

    ipcon.connect(HOST, PORT) # Connect to brickd
    # Don't use device before ipcon is connected

    # Get current intensity
    intensity = si.get_intensity()
    print("Intensity: " + str(intensity))

    raw_input("Press key to exit\n") # Use input() in Python 3
    ipcon.disconnect()