Example #1
0
def takephoto(photoname):
    #Switch on the relay.
    relay = fox.Pin('J7.4', 'low')
    relay.on()
    time.sleep(0.5)
    camera = vc0706()
    camera.take_photo(photoname)
    relay.off()
    #Photo now is copied to new folder, from there the chk_tpl will sort it.
    os.system('cp ' + photoname + ' /home/satice/new')
    print "Photo %s taken" % photoname
Example #2
0
def modemT(mode=false,type="fox"):
    """
	Toggles power or sleep status of the modem through a digital output. A discharge cycle 
	is always done to be sure the power on cycle timing is always respected. This particular
	side requirement allows us to issue a hard reset by calling a modemT(true).
    Compatibility depends on access to digital outputs. For PC use this function is not required.
    Input: 
		mode: false for OFF, true for ON
		type: device type, to load the propper hardware control for digital outputs
    Output: 
        Return true/false for on/off case the power status is required.
	Default call: modemT(0) #Powers off, fox type..
    """
	#Generic switch off for 30 seconds.
	if (debug): 
		print('Modem OFF \r') #Debug is a global boolean variable.
		logMe(home,"coms","Modem OFF")
	if type=="fox": #Add cases for other devices...
		fox.Pin('J7.35','low') #For mk3 satice PCB with Fox Board microP unit
Example #3
0
    """
	#Generic switch off for 30 seconds.
	if (debug): 
		print('Modem OFF \r') #Debug is a global boolean variable.
		logMe(home,"coms","Modem OFF")
	if type=="fox": #Add cases for other devices...
		fox.Pin('J7.35','low') #For mk3 satice PCB with Fox Board microP unit
    time.sleep(30) #required to discharge charge pump on the modem, according to manufacturer.
	mON=False
	
	if mode==true: 
		if (debug): 
			print('Modem ON \r')
			logMe(home,"coms","Modem ON")
		if type=="fox":
			fox.Pin('J7.35','high') #For mk3 satice PCB with Fox Board microP unit
		time.sleep(5)
		mON=True
	return mON

def serial_ports(): 
    """ Lists serial port names.
	Outputs:
        EnvironmentError: On unsupported or unknown platforms
        Result: A list of the serial ports, compatible with AT, available on the system. 
				If no serial ports are available with a modem, returns false (To Be Implemented).
    """
    if sys.platform.startswith('win'):
        ports = ['COM%s' % (i + 1) for i in range(256)]
    elif sys.platform.startswith('linux') or sys.platform.startswith('cygwin'):
        # this excludes your current terminal "/dev/tty"
Example #4
0
import time
import fox

print "Telit ON/OFF"

telitON = fox.Pin('J6', '37', 'low')

telitON.on()
time.sleep(1)
telitON.off()
Example #5
0
#!/usr/bin/python
import time
import fox

print "Telit ON/OFF"

telitRESET = fox.Pin('J6', '38', 'low')
telitON = fox.Pin('J6', '37', 'low')

telitON.on()
time.sleep(1)
telitON.off()
Example #6
0
import fox
import time

print "Blinking led"
print "Type ctrl-C to exit"

led = fox.Pin('J7', '3', 'low')

while True:
    time.sleep(0.2)
    led.on()
    time.sleep(0.2)
    led.off()
Example #7
0
        ["31", "32"],
        ["33", "34"],
        ["35", "36"],
        ["37", "38"],
    ],
}

for connector_index, connector_item in enumerate(test):
    #print connector_index, connector_item, test[connector_item]
    for test_index, test_item in enumerate(test[connector_item]):
        #for pin_index, pin_item in enumerate(test[connector_item][test_index]):
        #print "Test %s.%s - %s.%s" % (connector_item,test_item[0],connector_item,test_item[1])

        while True:
            error_counter = 0
            pin_out = fox.Pin(connector_item, test_item[0], 'low')
            pin_in = fox.Pin(connector_item, test_item[1], 'in')

            if pin_in.get_value() <> 0:
                print "gpio error %s.%s = low ->  %s.%s" % (
                    connector_item, test_item[0], connector_item, test_item[1])
                error_counter = error_counter + 1

            pin_out = fox.Pin(connector_item, test_item[0], 'high')
            pin_in = fox.Pin(connector_item, test_item[1], 'in')

            if pin_in.get_value() <> 1:
                print "gpio error %s.%s = high ->  %s.%s" % (
                    connector_item, test_item[0], connector_item, test_item[1])
                error_counter = error_counter + 1
Example #8
0
import fox
import time

print "Pressing button"
print "Type ctrl-C to exit"

led = fox.Pin('J7', '3', 'low')
button = fox.Pin('J7', '5', 'in')

while True:
    if button.get_value() == 0:
        led.on()
    else:
        led.off()