Пример #1
0
def initIO():
    """Инициализация линий ввода-вывода
    """
    SER2.set_speed('115200')
    # 0 - input, 1 - output, 2 - alt
    GPIO.setIOdir(4, 0, 0)  # SK1
    GPIO.setIOdir(3, 0, 0)  # SK2
    GPIO.setIOdir(6, 0, 1)  # RELE1
    GPIO.setIOdir(1, 0, 1)  # RELE2
    GPIO.setIOdir(5, 0, 1)  # SIM_SELECT
    GPIO.setIOdir(2, 0, 2)  # JDR
Пример #2
0
def initIO():
    """Инициализация линий ввода-вывода
    """
    SER2.set_speed('115200')
    # 0 - input, 1 - output, 2 - alt
    GPIO.setIOdir(4, 0, 0) # SK1
    GPIO.setIOdir(3, 0, 0) # SK2
    GPIO.setIOdir(6, 0, 1) # RELE1
    GPIO.setIOdir(1, 0, 1) # RELE2
    GPIO.setIOdir(5, 0, 1) # SIM_SELECT
    GPIO.setIOdir(2, 0, 2) # JDR
Пример #3
0
def initGPS (speed,format):
    
    # Method return value:
    #   -6 = Unknown error
    #   -5 = Incorrect NMEA command response
    #   -4 = No NMEA Command response
    #   -3 = NMEA Command response Checksum fail
    #   -1 = Exception occurred
    #    0 = Finished w/o error
    #   >0 = NMEA Command response error value

    tmpReturn = -1

    try:

        #Init Serial Port Settings
        res = SER2.set_speed(speed,format)
        if not(res == 1):
            return -6

        #Clear NMEA Buffer
        GPSdata.NMEA = SER2.read()
        GPSdata.NMEA = ''

        res = pollNMEA('8',2)
        tmpReturn = res

    except:
        printException("initGPS()")
        tmpReturn = -1
        
    return tmpReturn
Пример #4
0
import time
import USB0
import SER
import SER2

SER.set_speed('115200', '8N1')
SER2.set_speed('115200', '8N1')

i = 0
print('HOLA\n')
while i < 3:
    time.sleep(1)
    a = USB0.send('TEST\r\n')
    print('HOLA\n')
    b = SER.send('PAULO\n')
    c = SER2.send('BENITO\n')
    i = i + 1

SER.send('END of script\n')
SER2.send('END OF END\n')
Пример #5
0
            continue

        data += chr(byte)
        if not '\r' in data:
            time.sleep(0.1)
            continue

        line, data = data.split('\r', 2)
        if 'RING' in line:
            SER2.send('ring!!!\r\n')
            accept_call()
        else:
            SER2.send(line + '\r\n')


SER2.set_speed('9600', '8N1')
SER2.send('Starting...\r\n')
try:
    main()
except BaseException, e:
    SER2.send(repr(e))

#
# SER2.set_speed('115200', '8N1')
#
# MDM.send('AT+CMEE=2\n', 0)
# while True:
#     MDM.send('AT+COPS=?\r', 0)
#     MDM.send('AT+CSQ\r', 0)
#     MDM.send('AT+CREG?\r', 0)
#     for line in MDM.read().split('\r\n'):