示例#1
0
def print_master(conn, settings, uid):
    from tinkerforge.brick_master import BrickMaster  # type: ignore[import]
    br = BrickMaster(uid, conn)
    print_generic(
        settings,
        "master",
        br.get_identity(),
        1.0,
        "",
        br.get_stack_voltage(),
        br.get_stack_current(),
        br.get_chip_temperature(),
    )
示例#2
0
def print_master(conn, settings, uid):
    from tinkerforge.brick_master import BrickMaster  # type: ignore[import] # pylint: disable=import-error,import-outside-toplevel
    br = BrickMaster(uid, conn)
    print_generic(
        settings,
        "master",
        br.get_identity(),
        1.0,
        "",
        br.get_stack_voltage(),
        br.get_stack_current(),
        br.get_chip_temperature(),
    )
示例#3
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

HOST = "localhost"
PORT = 4223
UID = "XXYYZZ" # Change XXYYZZ to the UID of your Master Brick

from tinkerforge.ip_connection import IPConnection
from tinkerforge.brick_master import BrickMaster

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

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

    # Get current stack voltage (unit is mV)
    stack_voltage = master.get_stack_voltage()
    print("Stack Voltage: " + str(stack_voltage/1000.0) + " V")

    # Get current stack current (unit is mA)
    stack_current = master.get_stack_current()
    print("Stack Current: " + str(stack_current/1000.0) + " A")

    raw_input("Press key to exit\n") # Use input() in Python 3
    ipcon.disconnect()
示例#4
0
    # Don't use device before ipcon is connected

    # Display master status and LED blink
    master.enable_status_led()
    print(master.get_identity())
    cc = 0
    # Get current stack voltage (unit is mV)
    try:

        while True:
            cc = cc + 1
            stack_voltage = master.get_stack_voltage()
            #print("Stack Voltage: " + str(stack_voltage/1000.0) + " V")

            # Get current stack current (unit is mA)
            stack_current = master.get_stack_current()
            #print("Stack Current: " + str(stack_current/1000.0) + " A")

            # get wifi status
            iswifi = master.is_wifi2_present()
            #print ("wifi:" + str(iswifi))

            # Get current acceleration (unit is g/1000)
            x, y, z = a.get_acceleration()
            #print("Acceleration[X]: " + str(x/1000.0) + " g")
            #print("Acceleration[Y]: " + str(y/1000.0) + " g")
            #print("Acceleration[Z]: " + str(z/1000.0) + " g")

            # Get current distance (unit is mm)
            raw_distance = dir.get_distance_value()  #dir.get_distance()
            distmm = interpDist(raw_distance)