The pycoproc.py
file is a supporting python library for the first version of Pysense Pytrack and Pyscan expansionboards. For version 2.0 X, see pycoproc2
Initialise I2C communication with the supervisor MCU, if no i2c object is passed, the sda
and scl
pins are used. On the shield, the sensors are connected on these pins. Board type can be:
Pycoproc.PYSENSE
Pycoproc.PYTRACK
Pycoproc.PYSCAN
## General functions
Read the PIC firmware version. Check the update firmware if an update is available.
Read the hardware version.
Read the product ID
Returns True
if the on-board MCLR
button is pressed.
Returns the battery voltage
Sets the sleep time in seconds for py.go_to_sleep(...)
. This method will momentarily release the USB connection, meaning you will have to reconnect the USB in Pymakr after using this method.
Enables the accelerometer INT pin (PIC - RA5) as a wakeup source, if the accelerometer interrupt is configured. The boolean parameters will indicate rising edge (activity detection) and/or falling edge (inactivity detection) is configured.
Allow waking up from an interrupt on PIC RC1, or EXT_IO_0
on the external IO header
Puts the board in sleep mode. This sleep mode consumes less power than the machine.deepsleep()
available from the firmware, as it turns the power to the inserted development module off.This will also disable the power to the sensors, sd card and Pyport, except for the accelerometer. Arguments are:
gps
: Keep the GPS (if available) in standby mode while sleeping. This reduces the power consumption, but might extend the time to location fix after wakeup.In the event of a sleep session that was awoken by an asynchronous event (Accelerometer, INT pin or Reset button) the approximate sleep remaining interval (expressed in seconds) can be found out. The user has to manually use setup_sleep()
to configure the next sleep interval.