def low_bat(status):
    '''
    Turn on and off the low_bat bat LED flashing
    Will also buzz every 20 second
    status = True/False 
    '''
    global counter

    def flashit(status):
        global counter
        steelsquid_pi.po16_gpio_set(3, status)
        if status:
            if counter == 0:
                counter = counter + 1
                buz(True)
            elif counter == 10:
                counter = 0
            else:
                counter = counter + 1
        else:
            buz(False)

    steelsquid_utils.execute_flash("low_bat", status, 0.5, flashit, (True, ),
                                   flashit, (False, ))
    if not status:
        counter = 0
def paint_flash(matrix, rotate=2, address=0x70, seconds=1, status=None):
    '''
    Light a pattern
    matrix= two dimensinal array 8*8  [ROW, COLUMN]
    rotate: rotate the array clockwise this number of times
    '''
    steelsquid_utils.execute_flash("paint_flash", status, seconds, paint, (matrix, rotate, address,), paint, (empty, rotate, address,))
def buz_flash(status=None, seconds=1):
    '''
    Turn on and off the buzzer on given interval
    status = True/False (if None: On and of one time)
    seconds = On and off intervall
    only_ones = Flash it one time only
    '''
    steelsquid_utils.execute_flash("buz_flash", status, seconds, steelsquid_pi.po12_digital_out, (2, True,), steelsquid_pi.po12_digital_out, (2, False,))
def net_flash(status=None, seconds=1):
    '''
    Turn on and off the network led on given interval (NET)
    status = True/False (if None: On and of one time)
    seconds = On and off intervall
    only_ones = Flash it one time only
    '''
    steelsquid_utils.execute_flash("net_flash", status, seconds, net, (True,), net, (False,))
def bt_flash(status=None, seconds=1):
    '''
    Turn on and off the bluetooth led on given interval (BT)
    status = True/False (if None: On and of one time)
    seconds = On and off intervall
    only_ones = Flash it one time only
    '''
    steelsquid_utils.execute_flash("bt_flash", status, seconds, bt, (True,), bt, (False,))
def led_flash(led_nr, status=None, seconds=1):
    '''
    Turn on and off the LED on given interval
    led_nr = 1 to 6
    status = True/False (if None: On and of one time)
    seconds = On and off intervall
    only_ones = Flash it one time only
    '''
    steelsquid_utils.execute_flash("led" + str(led_nr), status, seconds, led, (led_nr, True,), led, (led_nr, False,))
def xgpio_flash(gpio, status=None, seconds=1):
    '''
    Set a gpio hight or low on XGPIO pins
    Change to hight (true) or low (false) on a pin alternately
    @param gpio: GPIO number
    @param status: True/False (None = Only alternate one time (True, false))
    @param seconds: Seconds between state change
    '''
    steelsquid_utils.execute_flash("xgpio_set"+str(gpio), status, seconds, xgpio_set, (gpio, True,), xgpio_set, (gpio, False,))
def net_flash(status=None, seconds=1):
    '''
    Turn on and off the network led on given interval (NET)
    status = True/False (if None: On and of one time)
    seconds = On and off intervall
    only_ones = Flash it one time only
    '''
    steelsquid_utils.execute_flash("net_flash", status, seconds, net, (True, ),
                                   net, (False, ))
def bt_flash(status=None, seconds=1):
    '''
    Turn on and off the bluetooth led on given interval (BT)
    status = True/False (if None: On and of one time)
    seconds = On and off intervall
    only_ones = Flash it one time only
    '''
    steelsquid_utils.execute_flash("bt_flash", status, seconds, bt, (True, ),
                                   bt, (False, ))
def gpio_flash(gpio, status=None, seconds=1, use_piio_pin_nr=True):
    '''
    Change to hight (true) or low (false) on a pin alternately
    This is marked with GPIO and GPIO_5V on the PIIO board.
    @param gpio: GPIO number
    @param status: True/False (None = Only alternate one time (True, false))
    @param seconds: Seconds between state change
    @param use_piio_pin_nr: Use PIIO pin nr or Raspberry GPIO nr.
    '''
    steelsquid_utils.execute_flash("gpio_flash"+str(gpio), status, seconds, gpio_set, (gpio, True, use_piio_pin_nr,), gpio_set, (gpio, False, use_piio_pin_nr,))
def power_flash(gpio, status=None, seconds=1):
    '''
    Set a gpio hight or low on POWER pins
    Change to hight (true) or low (false) on a pin alternately
    Connect POWER pin to the device you want to control (voltage from 4V to 50V), 500mA
    The POWER pin is GND, so from the voltage source to the device then to POWER pin.
    @param gpio: GPIO number
    @param status: True/False (None = Only alternate one time (True, false))
    @param seconds: Seconds between state change
    '''
    steelsquid_utils.execute_flash("power_flash"+str(gpio), status, seconds, power, (gpio, True,), power, (gpio, False,))
def led_flash(led_nr, status=None, seconds=1):
    '''
    Turn on and off the LED on given interval
    led_nr = 1 to 6
    status = True/False (if None: On and of one time)
    seconds = On and off intervall
    only_ones = Flash it one time only
    '''
    steelsquid_utils.execute_flash("led" + str(led_nr), status, seconds, led, (
        led_nr,
        True,
    ), led, (
        led_nr,
        False,
    ))
Ejemplo n.º 13
0
def paint_flash(matrix, rotate=0, address=0x70, seconds=1, status=None):
    '''
    Light a pattern
    matrix= two dimensinal array 8*8  [ROW, COLUMN]
    rotate: rotate the array clockwise this number of times
    '''
    steelsquid_utils.execute_flash("paint_flash", status, seconds, paint, (
        matrix,
        rotate,
        address,
    ), paint, (
        empty,
        rotate,
        address,
    ))
def buz_flash(status=None, seconds=1):
    '''
    Turn on and off the buzzer on given interval
    status = True/False (if None: On and of one time)
    seconds = On and off intervall
    only_ones = Flash it one time only
    '''
    steelsquid_utils.execute_flash("buz_flash", status, seconds,
                                   steelsquid_pi.po12_digital_out, (
                                       2,
                                       True,
                                   ), steelsquid_pi.po12_digital_out, (
                                       2,
                                       False,
                                   ))
def xgpio_flash(gpio, status=None, seconds=1):
    '''
    Set a gpio hight or low on XGPIO pins
    Change to hight (true) or low (false) on a pin alternately
    @param gpio: GPIO number
    @param status: True/False (None = Only alternate one time (True, false))
    @param seconds: Seconds between state change
    '''
    steelsquid_utils.execute_flash("xgpio_set" + str(gpio), status, seconds,
                                   xgpio_set, (
                                       gpio,
                                       True,
                                   ), xgpio_set, (
                                       gpio,
                                       False,
                                   ))
def power_flash(gpio, status=None, seconds=1):
    '''
    Set a gpio hight or low on POWER pins
    Change to hight (true) or low (false) on a pin alternately
    Connect POWER pin to the device you want to control (voltage from 4V to 50V), 500mA
    The POWER pin is GND, so from the voltage source to the device then to POWER pin.
    @param gpio: GPIO number
    @param status: True/False (None = Only alternate one time (True, false))
    @param seconds: Seconds between state change
    '''
    steelsquid_utils.execute_flash("power_flash" + str(gpio), status, seconds,
                                   power, (
                                       gpio,
                                       True,
                                   ), power, (
                                       gpio,
                                       False,
                                   ))
def gpio_flash(gpio, status=None, seconds=1, use_piio_pin_nr=True):
    '''
    Change to hight (true) or low (false) on a pin alternately
    This is marked with GPIO and GPIO_5V on the PIIO board.
    @param gpio: GPIO number
    @param status: True/False (None = Only alternate one time (True, false))
    @param seconds: Seconds between state change
    @param use_piio_pin_nr: Use PIIO pin nr or Raspberry GPIO nr.
    '''
    steelsquid_utils.execute_flash("gpio_flash" + str(gpio), status, seconds,
                                   gpio_set, (
                                       gpio,
                                       True,
                                       use_piio_pin_nr,
                                   ), gpio_set, (
                                       gpio,
                                       False,
                                       use_piio_pin_nr,
                                   ))
def low_bat(status):
    '''
    Turn on and off the low_bat bat LED flashing
    Will also buzz every 20 second
    status = True/False 
    '''
    global counter
    def flashit(status): 
        global counter
        steelsquid_pi.po16_gpio_set(3, status)
        if status:
            if counter==0:
                counter = counter+1
                buz(True)
            elif counter==10:
                counter=0
            else:
                counter = counter+1
        else:
            buz(False)
    steelsquid_utils.execute_flash("low_bat", status, 0.5, flashit, (True,), flashit, (False,))
    if not status:
        counter=0