コード例 #1
0
    led2.toggle()


# ---------------------------------------------------------------
# GNSS NMEA message parsed callback
# ---------------------------------------------------------------
def OnParsedMsg(msgType, msgItems):
    pass


# ---------------------------------------------------------------
# GNSS Modules
# ---------------------------------------------------------------

# Power-on the GNSS subsystem
gnss_pwr = Pin('PWR_GNSS', Pin.OUT_PP)
gnss_pwr.high()

# UART configuration of ZEDs with application buffer
zed1_uart = UART('ZED1', 115200, rxbuf=1024)

# Parser configuration
zed1_uart.parser(UART.ParserNMEA,
                 rxbuf=256,
                 rxcallback=OnNmeaMsg,
                 frcallback=OnParsedMsg)


# Main application process
def app_proc():
    while True:
コード例 #2
0

# ---------------------------------------------------------------
# GNSS UBX message parsed callback
# ---------------------------------------------------------------
def OnUbloxParsed(msgType, msgItems):
    print(msgType)
    print(msgItems)


# ---------------------------------------------------------------
# GNSS Modules
# ---------------------------------------------------------------

# Power-on the GNSS subsystem
gnss_pwr = Pin('PWR_GNSS', Pin.OUT_OD)
gnss_pwr.high()

# UART configuration of ZED with application buffer
zed1 = UART('ZED1', 115200, rxbuf=0, dma=True)

# ---------------------------------------------------------------
# XBEE Expansions
# ---------------------------------------------------------------

# Power-on the XBEE LP subsystem
xlp_pwr = Pin('PWR_XBEE_LP', Pin.OUT_PP)
xlp_pwr.high()

# Re-direct the XBEE LP subsystem to the MCU
xlp_dir = Pin('XBEE_LP_DIR', Pin.OUT_PP)
コード例 #3
0
import network
from sty import Pin
from sty import UART
import uasyncio as asyncio

# ---------------------------------------------------------------
# Power-on the XBEE subsystem
# ---------------------------------------------------------------

# XBEE Low Power Socket
xbee_lp_pwr = Pin('PWR_XBEE_LP', Pin.OUT_OD)
xbee_lp_pwr.high()

# XBEE Low Power Direction (XBEE_LP <-> MCU)
xbee_lp_dir = Pin('XBEE_LP_DIR', Pin.OUT_PP)
xbee_lp_dir.high()

# XBEE High Power Direction (XBEE_HP <-> MCU)
xbee_hp_dir = Pin('XBEE_HP_DIR', Pin.OUT_PP)
xbee_hp_dir.high()

# ---------------------------------------------------------------
# GSM Module Communication based socket interface (on XBEE-HP)
# ---------------------------------------------------------------

# Configure the network interface card (GSM)
pwr = Pin('PWR_XBEE_HP', Pin.OUT_OD)
nic = network.GSM(UART('XBEE_HP', 115200, rxbuf=1024, dma=False),
                  pwr_pin=pwr,
                  info=True)
コード例 #4
0
from sty import Pin, ExtInt


# External interrupt callback
def OnExtInt(line):
    print('line=', line)


# Configure the external interrupt
extint = ExtInt(Pin('DIN1'), ExtInt.IRQ_FALLING, Pin.PULL_NONE, OnExtInt)
コード例 #5
0
from sty import Pin
import utime

# ---------------------------------------------------------------
# Digital Inputs
# ---------------------------------------------------------------
IP1 = Pin('DIN1')
IP2 = Pin('DIN2')
IP3 = Pin('DIN3')
IP1.init(Pin.IN, Pin.PULL_NONE)
IP2.init(Pin.IN, Pin.PULL_NONE)
IP3.init(Pin.IN, Pin.PULL_NONE)

# ---------------------------------------------------------------
# Digital Outputs
# ---------------------------------------------------------------
QP1 = Pin('QP1', Pin.OUT_PP)
QP2 = Pin('QP2', Pin.OUT_PP)
QP3 = Pin('QP3', Pin.OUT_PP)
QP4 = Pin('QP4', Pin.OUT_PP)
QP5 = Pin('QP5', Pin.OUT_PP)
QP6 = Pin('QP6', Pin.OUT_PP)

# ---------------------------------------------------------------
# Toogle the outputs
# ---------------------------------------------------------------
print('Outputs are toggling...')
stat = 0
for i in range(10):
    if stat == 1:
        QP1.high()
コード例 #6
0
import utime
import usocket
import network
import _thread
from sty import Pin
from sty import UART

# ---------------------------------------------------------------
# GSM Module Communication based socket interface
# ---------------------------------------------------------------

# Configure the network interface card (GSM)
pwr = Pin('PWR_GSM', Pin.OUT_OD)
pon = Pin('M2M_PON', Pin.OUT_OD)
rst = Pin('M2M_RST', Pin.OUT_OD)
mon = Pin('M2M_MON', Pin.IN)
nic = network.GSM(UART('GSM',
                       115200,
                       flow=UART.RTS | UART.CTS,
                       rxbuf=1024,
                       dma=False),
                  pwr_pin=pwr,
                  pon_pin=pon,
                  rst_pin=rst,
                  mon_pin=mon,
                  info=True)


# ---------------------------------------------------------------
# Main application process
# ---------------------------------------------------------------
コード例 #7
0
from sty import Pin

# ---------------------------------------------------------------
# Power-On the Modem subsystem of RTK board
# ---------------------------------------------------------------
modem_pwr = Pin('PWR_GSM', Pin.OUT_OD)
modem_pwr.high()

# Console info
print('Modem Power-On')
print('You should see modem serial ports on your PC ;)')
コード例 #8
0
import _thread

# ---------------------------------------------------------------
# On-Board LEDs
# ---------------------------------------------------------------

led1 = sty.LED(1)
led2 = sty.LED(2)
led3 = sty.LED(3)

# ---------------------------------------------------------------
# GNSS Modules
# ---------------------------------------------------------------

# Power-on the GNSS subsystem
gnss_pwr = Pin('PWR_GNSS', Pin.OUT_PP)
gnss_pwr.high()

# UART configuration of ZED
zed1_uart = UART('ZED1', 115200, rxbuf=0)

# ---------------------------------------------------------------
# XBEE Expansions
# ---------------------------------------------------------------

# Power-on the XBEE LP subsystem
xlp_pwr = Pin('PWR_XBEE_LP', Pin.OUT_PP)
xlp_pwr.high()

# Power-on the XBEE HP subsystem
xhp_pwr = Pin('PWR_XBEE_HP', Pin.OUT_PP)
コード例 #9
0
from sty import Pin

# ---------------------------------------------------------------
# Power-Off the Modem subsystem of RTK board
# ---------------------------------------------------------------
modem_pwr = Pin('PWR_GSM', Pin.OUT_OD)
modem_pwr.low()

# Console info
print('Modem Power-Off')
コード例 #10
0
from sty import Pin, Timer

# ---------------------------------------------------------------
# Digital Outputs
# ---------------------------------------------------------------

# QP1 has TIM4 CH1
PWM1 = Pin('QP1')
# QP1 has TIM4 CH2
PWM2 = Pin('QP2')
# QP1 has TIM4 CH3
PWM3 = Pin('QP3')
# QP1 has TIM4 CH4
PWM4 = Pin('QP4')

# PWM Timer
tim = Timer(4, freq=1000)

# PWM Channels
ch1 = tim.channel(1, Timer.PWM, pin=PWM1)
ch2 = tim.channel(2, Timer.PWM, pin=PWM2)
ch3 = tim.channel(3, Timer.PWM, pin=PWM3)
ch4 = tim.channel(4, Timer.PWM, pin=PWM4)

# PWM Duty cycles
ch1.pulse_width_percent(25)
ch2.pulse_width_percent(50)
ch3.pulse_width_percent(75)
ch4.pulse_width_percent(100)
コード例 #11
0
import sty
import _thread
from sty import Pin

# ---------------------------------------------------------------
# On-Board LEDs
# ---------------------------------------------------------------

led1 = sty.LED(1)
led2 = sty.LED(2)
led3 = sty.LED(3)

# ---------------------------------------------------------------
# Digital Input for F9P Time Pulse
# ---------------------------------------------------------------
fp9_puls = Pin('F9P_PULS')

# ---------------------------------------------------------------
# Digital Output to reflect the F9P Time Pulse
# ---------------------------------------------------------------
QP1 = Pin('QP1', Pin.OUT_PP)


# ---------------------------------------------------------------
# Timer callback to redirect the time pulse
# ---------------------------------------------------------------
def OnTimer(timer):
    QP1.value(fp9_puls.value())
    led3.toggle()

コード例 #12
0
from sty import Pin

# ---------------------------------------------------------------
# Power-Off the GNSS subsystem of RTK board
# ---------------------------------------------------------------
gnss_pwr = Pin('PWR_GNSS', Pin.OUT_OD)
gnss_pwr.low()

# Console info
print('GNSS Power-Off')
コード例 #13
0
import utime
import usocket
import network
import _thread
from sty import Pin
from sty import UART

# ---------------------------------------------------------------
# GSM Module Communication based socket interface
# ---------------------------------------------------------------

# Configure the network interface card (GSM)
pwr = Pin('PWR_GSM', Pin.OUT_OD)
mon = Pin('GSM_MON', Pin.IN, Pin.PULL_DOWN)
nic = network.GSM(UART('GSM', 115200, flow=UART.RTS|UART.CTS, rxbuf=1024, dma=False), pwr_pin=pwr, mon_pin=mon, info=True)

# ---------------------------------------------------------------
# Main application process
# ---------------------------------------------------------------
def app_proc():

    # Start up delay to allow REPL message
    utime.sleep_ms(1000)

    # Print info
    print('GSM connection started...\r\n')

    # Configure the GSM parameters
    nic.config(user='******', pwd='gprs', apn='internet', pin='1234')

    # Connect to the gsm network