mirror of
https://github.com/sascha-hemi/pycom-documentation.git
synced 2026-03-21 12:05:39 +01:00
* restructuring Pycoproc documentation * Fixed formatting * added to menu tree * removed the pytrack / pysense layer * Completed the Pycoproc API * fixed naming * updated landing page * renamed to shields * added v16 warning * restructuring Pycoproc documentation * Fixed formatting * added to menu tree * removed the pytrack / pysense layer * Completed the Pycoproc API * fixed naming * updated landing page * renamed to shields * added v16 warning * added sensor list and changed naming * modified links * changed menu names * updated naming
1.8 KiB
1.8 KiB
title, aliases
| title | aliases | |||
|---|---|---|---|---|
| Pytrack 2.0 X Examples |
|
The Pytrack 2.0 X has an external header that allows you to attach all kinds of sensors.
All sensors
Note: You can find this example in the GitHub repository. Over there, you can also find the relevant libraries.
#!/usr/bin/env python
#
# Copyright (c) 2020, Pycom Limited.
#
# This software is licensed under the GNU GPL version 3 or any
# later version, with permitted additional terms. For more information
# see the Pycom Licence v1.0 document supplied with this file, or
# available at https://www.pycom.io/opensource/licensing
#
import machine
import math
import network
import os
import time
import utime
import gc
import pycom
from machine import RTC
from machine import SD
from L76GNSS import L76GNSS
from pytrack import Pytrack
pycom.heartbeat(False)
pycom.rgbled(0x0A0A08) # white
time.sleep(2)
gc.enable()
# setup rtc
rtc = machine.RTC()
rtc.ntp_sync("pool.ntp.org")
utime.sleep_ms(750)
print('\nRTC Set from NTP to UTC:', rtc.now())
utime.timezone(7200)
print('Adjusted from UTC to EST timezone', utime.localtime(), '\n')
py = Pytrack()
time.sleep(1)
l76 = L76GNSS(py, timeout=30, buffer=512)
# sd = SD()
# os.mount(sd, '/sd')
# f = open('/sd/gps-record.txt', 'w')
# while (True):
for _ in range(5):
coord = l76.coordinates()
#f.write("{} - {}\n".format(coord, rtc.now()))
print("{} - {} - {}".format(coord, rtc.now(), gc.mem_free()))
"""
# sleep procedure
time.sleep(3)
py.setup_sleep(10)
py.go_to_sleep()
"""