Example #1
0
def test_switch():
    data_test = [120, 120, 120, 120, 120, 120, 120, 120, 0, 0, 131, 260]

    dcapi.init()
    dcapi.ppm_update(data_test)
    dcapi.enable_control(1)

    try:

        while dcapi.read_button() == 0:
            time.sleep(1)
            if dcapi.read_ch1() == 1:
                print 'CH1 on'
            else:
                print 'CH1 off'

            if dcapi.read_ch2() == 1:
                print 'CH2 on'
            else:
                print 'CH2 off'

        print "exiting.."

    finally:
        dcapi.enable_control(0)
        print "script termine, controle rendu"
        dcapi.free_pi()
Example #2
0
def test_switch():
    data_test = [120,120,120,120, 120,120,120,120,0,0,131,260]

    dcapi.init()
    dcapi.ppm_update(data_test)
    dcapi.enable_control(1)

    try:

        while dcapi.read_button() == 0:
            time.sleep(1)
            if dcapi.read_ch1() == 1 :
                print 'CH1 on'
            else:
                print 'CH1 off'

            if dcapi.read_ch2() == 1:
                 print 'CH2 on'
            else:
                print 'CH2 off'

        print "exiting.."

    finally:
        dcapi.enable_control(0)
        print "script termine, controle rendu"
        dcapi.free_pi()
Example #3
0
def demo_start_stop():
    button = 0
    try:
        dcapi.enable_control(1)

        print 'attente controle'
        while dcapi.read_ch1() == 0: # attente controle
            if dcapi.read_button() == 1:
                button = 1 
                break
            time.sleep(0.1)
            
        dcapi.led_blink()
        print str(dcapi.calibration_gyro())
        dcapi.led_on()

        while button == 0:

            print 'attente arming'
            while dcapi.read_ch2() == 0: # attente ordre arming
                if dcapi.read_button() == 1:
                    button = 1
                    break
                time.sleep(0.1)

            if button == 0:
                dcapi.led_blink()
                print str(dcapi.arm())
                dcapi.led_on()

            print 'attente disarming'
            while dcapi.read_ch2() == 1: # attente ordre disarming
                if dcapi.read_button() == 1:
                    button = 1
                    break
                time.sleep(0.1)

            if button == 0:
                dcapi.led_blink()
                print str(dcapi.disarm())
                dcapi.led_on()

   
    finally:
        dcapi.enable_control(0)
        print "script termine, controle rendu"
        dcapi.free_pi()
Example #4
0
def demo_start_stop():
    button = 0
    try:
        dcapi.enable_control(1)

        print 'attente controle'
        while dcapi.read_ch1() == 0:  # attente controle
            if dcapi.read_button() == 1:
                button = 1
                break
            time.sleep(0.1)

        dcapi.led_blink()
        print str(dcapi.calibration_gyro())
        dcapi.led_on()

        while button == 0:

            print 'attente arming'
            while dcapi.read_ch2() == 0:  # attente ordre arming
                if dcapi.read_button() == 1:
                    button = 1
                    break
                time.sleep(0.1)

            if button == 0:
                dcapi.led_blink()
                print str(dcapi.arm())
                dcapi.led_on()

            print 'attente disarming'
            while dcapi.read_ch2() == 1:  # attente ordre disarming
                if dcapi.read_button() == 1:
                    button = 1
                    break
                time.sleep(0.1)

            if button == 0:
                dcapi.led_blink()
                print str(dcapi.disarm())
                dcapi.led_on()

    finally:
        dcapi.enable_control(0)
        print "script termine, controle rendu"
        dcapi.free_pi()
Example #5
0
def test_ch():
    data_test = [127,127,127,127,127,127,127,127,127,127,127,127]
    channel=0
    try:
        dcapi.enable_control(1)
        while dcapi.read_button() == 0:
            channel = input ('Channel:')
            data_test [channel-1] = input ('Valeur:')
            dcapi.ppm_update(data_test)
    finally:
        dcapi.enable_control(0)
        print "script termine, controle rendu"
        dcapi.free_pi()
Example #6
0
def test_ch():
    data_test = [127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127]
    channel = 0
    try:
        dcapi.enable_control(1)
        while dcapi.read_button() == 0:
            channel = input('Channel:')
            data_test[channel - 1] = input('Valeur:')
            dcapi.ppm_update(data_test)
    finally:
        dcapi.enable_control(0)
        print "script termine, controle rendu"
        dcapi.free_pi()
Example #7
0
import time

import dcapi

dcapi.init()

try:
    dcapi.enable_control(1)
    print 'ch1:' + str(dcapi.read_ch1())
    print 'enable:' + str(dcapi.ENABLE_STATE)

    print str(dcapi.calibration_acc())
    time.sleep(3)
    print str(dcapi.arm())
    time.sleep(3)
    print str(dcapi.disarm())
    time.sleep(3)

    while dcapi.read_button() == 0:
        time.sleep(1)
        print str(dcapi.write_channel(11, 200, 1))

finally:  # quand on quitte, normalement ou pas
    dcapi.enable_control(0)
    print "script termine, controle rendu"
    dcapi.free_pi()
Example #8
0
import time

import dcapi

dcapi.init()
button = 0

try:
    dcapi.enable_control(1)

    print 'attente controle'
    while dcapi.read_ch1() == 0:  # attente controle
        if dcapi.read_button() == 1:
            button = 1
            break
        time.sleep(0.1)

    dcapi.led_blink()
    print str(dcapi.calibration_acc())
    dcapi.led_on()

    while button == 0:

        print 'attente arming'
        while dcapi.read_ch2() == 0:  # attente ordre arming
            if dcapi.read_button() == 1:
                button = 1
                break
            time.sleep(0.1)

        if button == 0:
Example #9
0
import time

import dcapi

dcapi.init()

try:
    dcapi.enable_control(1)
    print 'ch1:' + str(dcapi.read_ch1())
    print 'enable:' + str(dcapi.ENABLE_STATE)
    
    print str(dcapi.calibration_acc())
    time.sleep(3)
    print str(dcapi.arm())
    time.sleep(3)
    print str(dcapi.disarm())
    time.sleep(3)
    
    while dcapi.read_button() == 0:
        time.sleep(1)
        print str(dcapi.write_channel(11, 200, 1))


finally:                      # quand on quitte, normalement ou pas
    dcapi.enable_control(0)
    print "script termine, controle rendu"
    dcapi.free_pi()
Example #10
0
import time

import dcapi

dcapi.init()
button = 0

try:
    dcapi.enable_control(1)

    print 'attente controle'
    while dcapi.read_ch1() == 0: # attente controle
        if dcapi.read_button() == 1:
            button = 1 
            break
        time.sleep(0.1)
        
    dcapi.led_blink()
    print str(dcapi.calibration_acc())
    dcapi.led_on()

    while button == 0:

        print 'attente arming'
        while dcapi.read_ch2() == 0: # attente ordre arming
            if dcapi.read_button() == 1:
                button = 1
                break
            time.sleep(0.1)

        if button == 0: