Merge branch 'publish' into pysense2-pytrack2

This commit is contained in:
gijsio
2020-12-11 11:12:45 +01:00
committed by GitHub
77 changed files with 536 additions and 1087 deletions

View File

@@ -1174,12 +1174,19 @@ theme = "doc-theme"
weight = 10
[[menu.main]]
name = "Visualise data"
name = "Visualise signals"
url = "/pybytes/dashboard/"
identifier = "pybytes@dashboard"
parent = "pybytes"
weight = 15
[[menu.main]]
name = "Pymakr Online"
url = "/pybytes/pymakr-online/"
identifier = "pybytes@pymakr-online"
parent = "pybytes"
weight = 17
[[menu.main]]
name = "Pybytes library API"
url = "/pybytes/api/"
@@ -1187,188 +1194,6 @@ theme = "doc-theme"
parent= "pybytes"
weight = 20
[[menu.main]]
name = "Activate Device"
url = "/pybytes/api/activate/"
identifier = "pybytes@api@activate"
parent = "pybytes@api"
weight = 11
[[menu.main]]
name = "Connect"
url = "/pybytes/api/connect_device/"
identifier = "pybytes@api@connect_device"
parent = "pybytes@api"
weight = 12
[[menu.main]]
name = "Connect LTE"
url = "/pybytes/api/connect_lte/"
identifier = "pybytes@api@connect_lte"
parent = "pybytes@api"
weight = 13
[[menu.main]]
name = "Connect loRa ABP"
url = "/pybytes/api/connect_lora_abp/"
identifier = "pybytes@api@connect_lora_abp"
parent = "pybytes@api"
weight = 14
[[menu.main]]
name = "Connect loRa OTAA"
url = "/pybytes/api/connect_lora_otaa/"
identifier = "pybytes@api@connect_lora_otaa"
parent = "pybytes@api"
weight = 15
[[menu.main]]
name = "Connect Sigfox"
url = "/pybytes/api/connect_sigfox/"
identifier = "pybytes@api@connect_sigfox"
parent = "pybytes@api"
weight = 16
[[menu.main]]
name = "Connect Wifi"
url = "/pybytes/api/connect_wifi/"
identifier = "pybytes@api@connect_wifi"
parent = "pybytes@api"
weight = 17
[[menu.main]]
name = "Deepsleep"
url = "/pybytes/api/deepsleep/"
identifier = "pybytes@api@deepsleep"
parent = "pybytes@api"
weight = 19
[[menu.main]]
name = "Disconnect"
url = "/pybytes/api/disconnect/"
identifier = "pybytes@api@disconnect"
parent = "pybytes@api"
weight = 20
[[menu.main]]
name = "Dump CA"
url = "/pybytes/api/dump_ca/"
identifier = "pybytes@api@dump_ca"
parent = "pybytes@api"
weight = 22
[[menu.main]]
name = "Enable LTE"
url = "/pybytes/api/enable_lte/"
identifier = "pybytes@api@enable_lte"
parent = "pybytes@api"
weight = 23
[[menu.main]]
name = "Enable SSL"
url = "/pybytes/api/enable_ssl/"
identifier = "pybytes@api@enable_ssl"
parent = "pybytes@api"
weight = 24
[[menu.main]]
name = "Enable terminal"
url = "/pybytes/api/enable_terminal/"
identifier = "pybytes@api@enable_terminal"
parent = "pybytes@api"
weight = 25
[[menu.main]]
name = "Export configuration"
url = "/pybytes/api/export_config/"
identifier = "pybytes@api@export_config"
parent = "pybytes@api"
weight = 26
[[menu.main]]
name = "Get configuration"
url = "/pybytes/api/get_config/"
identifier = "pybytes@api@get_config"
parent = "pybytes@api"
weight = 27
[[menu.main]]
name = "Is connected"
url = "/pybytes/api/is_connected/"
identifier = "pybytes@api@is_connected"
parent = "pybytes@api"
weight = 28
[[menu.main]]
name = "Print configuration"
url = "/pybytes/api/print_config/"
identifier = "pybytes@api@print_config"
parent = "pybytes@api"
weight = 29
[[menu.main]]
name = "Read configuration"
url = "/pybytes/api/read_config/"
identifier = "pybytes@api@read_config"
parent = "pybytes@api"
weight = 30
[[menu.main]]
name = "Reconnect"
url = "/pybytes/api/reconnect/"
identifier = "pybytes@api@reconnect"
parent = "pybytes@api"
weight = 31
[[menu.main]]
name = "Send info message"
url = "/pybytes/api/send_info_message/"
identifier = "pybytes@api@send_info_message"
parent = "pybytes@api"
weight = 32
[[menu.main]]
name = "Send ping message"
url = "/pybytes/api/send_ping_message/"
identifier = "pybytes@api@send_ping_message"
parent = "pybytes@api"
weight = 33
[[menu.main]]
name = "Send signal"
url = "/pybytes/api/send_signal/"
identifier = "pybytes@api@send_signal"
parent = "pybytes@api"
weight = 34
[[menu.main]]
name = "Set configuration"
url = "/pybytes/api/set_config/"
identifier = "pybytes@api@set_config"
parent = "pybytes@api"
weight = 35
[[menu.main]]
name = "Start"
url = "/pybytes/api/start/"
identifier = "pybytes@api@start"
parent = "pybytes@api"
weight = 36
[[menu.main]]
name = "Update configuration"
url = "/pybytes/api/update_config/"
identifier = "pybytes@api@update_config"
parent = "pybytes@api"
weight = 37
[[menu.main]]
name = "Write configuration"
url = "/pybytes/api/update_config/"
identifier = "pybytes@api@write_config"
parent = "pybytes@api"
weight = 38
[[menu.main]]
name = "Add a device to Pybytes"
url = "/pybytes/connect/"
@@ -1710,19 +1535,25 @@ theme = "doc-theme"
identifier = "advance@cli"
parent = "advance"
weight = 20
[[menu.main]]
name = "Coredump"
url = "/advance/coredump/"
identifier = "advance@coredump"
parent= "advance"
weight = 30
[[menu.main]]
name = "SecureBoot and Encryption"
url = "/advance/encryption/"
identifier = "advance@encryption"
parent = "advance"
weight = 30
weight = 40
[[menu.main]]
name = "Frozen code"
url = "/advance/frozen/"
identifier = "advance@frozen"
parent = "advance"
weight = 40
weight = 50
[[menu.main]]
name="License"

View File

@@ -9,7 +9,7 @@ aliases:
![](/gitbook/assets/fipy-1.png)
> Note: Orient the RGB LED / reset button over the USB connector on any expansion board
> Note: Orient the RGB LED / reset button over the USB connector on any expansion board
@@ -25,7 +25,7 @@ The datasheet of the FiPy is available as a [PDF File](/gitbook/assets/specsheet
The drawing of the LTE-M antenna is available as a [PDF File](/gitbook/assets/lte-m-antenna-drawing.pdf).
The Fipy is certified for [CE RED](/gitbook/assets/fipy_c03-b0-red-final.pdf) and [FCC DSS](/gitbook/assets/pycom-2ajmtfipy01r-fcc-grant-dss.pdf) [FCC DTS](/gitbook/assets/pycom-2ajmtfipy01r-fcc-grant-dts.pdf) [FCC DXX](/gitbook/assets/pycom-2ajmtfipy01r-fcc-grant-dxx.pdf) [FCC TNB](/gitbook/assets/pycom-2ajmtfipy01r-fcc-grant-tnb.pdf)
[RCM](/gitbook/assets/RCM-Fipy.pdf)
[RCM](/gitbook/assets/RCM-FIPY.zip)
[ROHS certification](/gitbook/assets/RoHs_declarations/RoHS-for-FiPy(8217-00091P)-20190523.pdf)
## Pinout
@@ -41,7 +41,7 @@ The pinout of the FiPy is available as a [PDF File](/gitbook/assets/fipy-pinout.
Do not use the 3.3V pin **in combination with** the Vin pin to supply the device as this will damage the voltage regulator on the board.
### Antenna placement
Always attach the appropriate antenna when using a wireless connection (LoRa / LTE / SigFox). For WiFi / BLE, it is not mandatory to use an external antenna when you did not explicitly specify this in your code.
Always attach the appropriate antenna when using a wireless connection (LoRa / LTE / SigFox). For WiFi / BLE, it is not mandatory to use an external antenna when you did not explicitly specify this in your code.
### AT Commands

View File

@@ -9,7 +9,7 @@ aliases:
![](/gitbook/assets/gpy-1.png)
> Note: Orient the RGB LED / reset button over the USB connector on any expansion board
> Note: Orient the RGB LED / reset button over the USB connector on any expansion board
**Store**: [Buy Here](https://pycom.io/product/gpy)
@@ -22,9 +22,9 @@ The datasheet of the GPy is available as a [PDF File](/gitbook/assets/specsheets
The drawing of the LTE-M antenna is available as a [PDF File](/gitbook/assets/lte-m-antenna-drawing.pdf)
The Gpy is certified for [CE RED](/gitbook/assets/c03-b0-red-gpy.pdf) and [FCC DSS](/gitbook/assets/pycom-2ajmtgpy01r-fcc-grant-dss.pdf) [FCC DTS](/gitbook/assets/pycom-2ajmtgpy01r-fcc-grant-dts.pdf) [FCC TNB](/gitbook/assets/pycom-2ajmtgpy01r-fcc-grant-tnb.pdf)
The Gpy is certified for [CE RED](/gitbook/assets/c03-b0-red-gpy.pdf) and [FCC DSS](/gitbook/assets/pycom-2ajmtgpy01r-fcc-grant-dss.pdf) [FCC DTS](/gitbook/assets/pycom-2ajmtgpy01r-fcc-grant-dts.pdf) [FCC TNB](/gitbook/assets/pycom-2ajmtgpy01r-fcc-grant-tnb.pdf)
[RCM](/gitbook/assets/RCM-Gpy.pdf)
[RCM](/gitbook/assets/RCM-GPy.zip)
[ROHS certification](/gitbook/assets/RoHs_declarations/RoHS-for-GPy(8217-00090P)-20190523.pdf)
@@ -44,7 +44,7 @@ Please note that the PIN assignments for UART1 \(TX1/RX1\), SPI \(CLK, MOSI, MIS
Do not use the 3.3V pin **in combination with** the Vin pin to supply the device as this will damage the voltage regulator on the board.
### Antenna placement
Always attach the appropriate antenna when using a wireless connection (LTE). For WiFi / BLE, it is not mandatory to use an external antenna when you did not explicitly specify this in your code.
Always attach the appropriate antenna when using a wireless connection (LTE). For WiFi / BLE, it is not mandatory to use an external antenna when you did not explicitly specify this in your code.
### AT Commands

View File

@@ -10,7 +10,7 @@ aliases:
![](/gitbook/assets/lopy4-1.png)
> Note: Orient the RGB LED / reset button over the USB connector on any expansion board
> Note: Orient the RGB LED / reset button over the USB connector on any expansion board
**Store**: [Buy Here](https://pycom.io/product/lopy4/)
@@ -21,7 +21,7 @@ aliases:
The datasheet of the LoPy4 is available as a [PDF File](/gitbook/assets/specsheets/Pycom_002_Specsheets_LoPy4_v2.pdf)
The Lopy 4 is certified for [CE RED](/gitbook/assets/C03-B0-RED-final.pdf) and [FCC DSS](/gitbook/assets/Pycom-2AJMTLOPY4R-FCC-Grant-DSS.pdf)
[RCM](/gitbook/assets/RCM-Lopy4.pdf)
[RCM](/gitbook/assets/RCM-LOPY4.zip)
[ROHS certification](/gitbook/assets/RoHs_declarations/RoHS-for-LoPy-4(8286-00027P)-20190523.pdf)
@@ -40,11 +40,11 @@ The pinout of the LoPy4 is available as a [PDF File](/gitbook/assets/lopy4-pinou
Do not use the 3.3V pin **in combination with** the Vin pin to supply the device as this will damage the voltage regulator on the board.
### Antenna placement
Always attach the appropriate antenna when using a wireless connection (LoRa / SigFox). For WiFi / BLE, it is not mandatory to use an external antenna when you did not explicitly specify this in your code.
Always attach the appropriate antenna when using a wireless connection (LoRa / SigFox). For WiFi / BLE, it is not mandatory to use an external antenna when you did not explicitly specify this in your code.
### Power
Do not use the 3.3V pin **in combination with** the Vin pin to supply the device as this will damage the voltage regulator on the board.
### Antenna placement
Always attach the appropriate antenna when using a wireless connection (LoRa / LTE). For WiFi / BLE, it is not mandatory to use an external antenna when you did not explicitly specify this in your code.
Always attach the appropriate antenna when using a wireless connection (LoRa / LTE). For WiFi / BLE, it is not mandatory to use an external antenna when you did not explicitly specify this in your code.

View File

@@ -20,13 +20,14 @@ The datasheet of the Expansion Board is available as a [PDF File](/gitbook/asset
The pinout of the Expansion Board is available as a [PDF File](/gitbook/assets/expansion3-pinout.pdf)
The expansion board contains 6 headers labeled:
- TX: TX UART communication of the development board
- RX: RX UART communication of the development board
- RUN
- BAT
- LED
- CHG: Decrease battery charging current from 450mA to 100mA
The expansion board contains 7 jumpers labeled:
- TX: TX UART (GPIO1) communication of the development board to the Expansionboard
- RTS: Can be used for UART flow control. Connected to GPIO7.
- RX: RX UART (GPIO2() communication of the development board to the Expansionboard
- CTS: Can be used for UART flow control. Connected to GPIO6.
- BAT: Connect the resistor divider on the Expansionboard to the Voltage monitoring ADC Pin (GPIO3)
- LED: Connect the LED on the Expansionboard to GPIO16
- CHG: Removing the jumper will decrease battery charging current from 450mA to 100mA
![](/gitbook/assets/expansion3-pinout-1.png)

View File

@@ -15,6 +15,7 @@ The datasheet of the Pytrack is available as a [PDF File](/gitbook/assets/PyTrac
## Pinout
The PyPort connector is for a 6 lead mini ribbon cable. Part: Amphenol 20021511-00006T4LF.
The external IO header power pins are labelled as follows
* 3V3AUX - The power provided by the development module
@@ -24,6 +25,9 @@ The external IO header power pins are labelled as follows
The pinout of the Pytrack is available as a [PDF File](
/gitbook/assets/pytrack2-pinout.pdf)
The Pytrack 2.0 X features a SMA connector that allows for the connection of an external active or passive GPS antenna. The SMA connector has an internal switch that switches the connection from the internal to the external antenna automatically upon connection of the external antenna.
![](/gitbook/assets/pytrack2-pinout.png)
## Notes

View File

@@ -22,7 +22,7 @@ The pinout of the G01 is available as a [PDF File](/gitbook/assets/g01-pinout.pd
The G01 is certified for [CE RED](/gitbook/assets/c03-b0-red-final-g01.pdf) and [FCC DSS](/gitbook/assets/pycom-2ajmtg01r-fcc-grant-dss.pdf)
[FCC DTS](/gitbook/assets/pycom-2ajmtg01r-fcc-grant-dts.pdf)
[FCC TNB](/gitbook/assets/pycom-2ajmtg01r-fcc-grant-tnb.pdf)
[RCM](/gitbook/assets/RCM-G01.pdf)
[RCM](/gitbook/assets/RCM-G01.zip)
[ROHS certification](/gitbook/assets/c03-b0-red-final.pdf)
![](/gitbook/assets/g01-pinout.png)
@@ -42,4 +42,3 @@ The AT commands for the Sequans Monarch modem on the G01 are available in a [PDF
## Tutorials
Tutorials on the G01 module can be found in the [examples](/tutorials/) section of this documentation.

View File

@@ -88,7 +88,6 @@ print()
print("\nthe racer took %f seconds to finish the race" % total)
print(" %f seconds in the first lap" % lap)
print(" %f seconds in the last lap" % (total - lap))
class Alarm get interrupted after a specific interval
```
## class Alarm

View File

@@ -25,7 +25,6 @@ A UART object acts like a stream object therefore reading and writing is done us
```python
uart.read(10) # read 10 characters, returns a bytes object
uart.readall() # read all available characters
uart.readline() # read a line
uart.readinto(buf) # read and store into the given buffer
uart.write('abc') # write the 3 characters
@@ -105,15 +104,10 @@ Return the number of characters available for reading.
### uart.read([nbytes])
Read characters. If `nbytes` is specified then read at most that many bytes.
Read characters. If `nbytes` is specified then read at most that many bytes. If not specified, it will read all bytes in the buffer.
Return value: a bytes object containing the bytes read in. Returns `None` on timeout.
### uart.readall()
Read as much data as possible.
Return value: a bytes object or `None` on timeout.
### uart.readinto(buf, [nbytes])

View File

@@ -63,7 +63,7 @@ The arguments are:
* `adr` enables Adaptive Data Rate.
* `public` selects between the public and private sync word.
* `tx_retries` sets the number of TX retries in `LoRa.LORAWAN` mode.
* `device_class` sets the LoRaWAN device class. Can be either:
* `device_class` sets the LoRaWAN device class. Visit the [TTN Website](https://www.thethingsnetwork.org/docs/lorawan/classes.html) to learn more about the LoRa device classes. Can be either:
* `LoRa.CLASS_A`
* `LoRa.CLASS_C`
@@ -137,6 +137,8 @@ Where:
* `tx_counter` is the number of packets transmitted.
* `tx_frequency` is the frequency used for the last transmission.
> Note that the tuple will only contain the respective information after receiving and/or sending LoRa packets.
### lora.has_joined()
Returns `True` if a LoRaWAN network has been joined. `False` otherwise.

View File

@@ -12,34 +12,28 @@ On each Pycom device, there is a small internal filesystem called `/flash`, to w
## Connecting
1. **Connect through the Access Point**
By default, the Pycom device will create a WiFi access point with the following default credentials:
* SSID: `xxpy-wlan-####`
* Password: `www.pycom.io`
The last 4 characters of the broadcast SSID are equal to the last 4 characters of the `unique_id()`:
```python
import machine
import ubinascii
ubinascii.hexlify(machine.unique_id())
```
Note that if you made changes to the WiFi settings, the AP might not show up by default. You can use the following to get it back up and running:
You can activate the internal Access Point (AP) on boot by using the following:
```python
import pycom
from network import WLAN
pycom.pybytes_on_boot(False) #we do not want Pybytes using the WLAN
pycom.smart_config_on_boot(False) #we also do not want smart config
pycom.wifi_on_boot(True)
pycom.wifi_mode_on_boot(WLAN.AP)
pycom.wifi_ssid_ap('ssid')
```
> You can find the methods to change the default settings [here](/firmwareapi/pycom/pycom/#boot-methods)
2. **Connect through A WiFi Network**
It is also possible to connect your pycom device to a WiFi network first, and then connect to its IP address. Note that you will have to figure out its IP address before you can access the FTP server. For that, you can use the following command. This will return a tuple with four items, where the first item will contain the assigned IP address.
It is also possible to connect your pycom device to a WiFi network first, and then connect to its IP address. Note that you will have to figure out its IP address before you can access the FTP server or use [MDNS](/tutorials/networkprotocols/mdns/). For that, you can use the following command. This will return a tuple with four items, where the first item will contain the assigned IP address.
```python
wlan.ifconfig()
```
> Note that if you make changes to the WLAN Configuration in the uploaded Python code, the connection might drop. Moreover, if your program contains continuous reboot loops, sleep cycles or coredumps, you might not be able to recover the wireless connection without [safe booting](../safeboot/)
Note that if you make changes to the WLAN Configuration in the uploaded Python code, for example by using Pybytes or changing the WiFi credentials, the connection might drop. Moreover, if your program contains continuous reboot loops, sleep cycles or coredumps, you might not be able to recover the wireless connection without [safe booting](../safeboot/)
## FTP Server
The file system is accessible via the native FTP server running on each Pycom device. Open a FTP client and connect to:

View File

@@ -16,13 +16,18 @@ Some times the code you have written will prevent you gaining access to the REPL
* Your code gets stuck before reaching the REPL
* You set a socket as blocking but never receive any data
In order to fix this you can safe boot your module. This will prevent `boot.py` and `main.py` from being executed and will drop you straight into the interactive REPL. After reset, if `P12` pin is held `high` (i.e. connect it to the `3V3` output pin), the heartbeat LED will begin flashing orange slowly. If after 3 seconds the pin is still held high, the LED will start blinking faster. In this mode the module will do the same as previously explained but it will also select the previous OTA image to boot if you have updated the module via the OTA update procedure (updates performed via the firmware update tool do not count). This is useful if you flashed a OTA update that breaks the device.
In order to fix this you can safe boot your module. This will prevent `boot.py` and `main.py` from being executed and will drop you straight into the interactive REPL. After reset, if `P12` pin is held `high` (i.e. connect it to the `3V3` output pin), the heartbeat LED will begin flashing orange slowly. If after 3 seconds the pin is still held high, the LED will start blinking faster. In this mode the module will do the same as previously explained but it will also select the previous OTA image to boot if you have updated the module via the OTA update procedure (updates performed via the firmware update tool do not count). This is useful if you flashed a OTA update that breaks the device. The following expansionboards have a dedicated safeboot-button:
| Expansionboard 3.1 | Pygate | Pysense 2.0X | Pytrack 2.0 X |
|:----|:---|:-----|:-----|
| ![](/gitbook/assets/expansionboards/expansionboard31_sb.png) | ![](/gitbook/assets/expansionboards/pygate_sb.png)]| ![](/gitbook/assets/expansionboards/pysense2_sb.png)| ![](/gitbook/assets/expansionboards/pytrack2_sb.png) |
Pin `P12` released during:
| 1st 3 secs window | 2nd 3 secs window |
| 1st 3 secs window (slow flashing) | 2nd 3 secs window (fast flashing) |
| :--- | :--- |
| Disable `boot.py` and `main.py` | Same as previous but using previous OTA firmware |
| Disable `boot.py` and `main.py` | Disable `boot.py` and `main.py` and use previous OTA firmware |
The selection made during safe boot is not persistent, therefore after the next normal reset, the latest firmware will proceed to run again.

View File

@@ -16,7 +16,7 @@ At Pycom, we manufacture and sell several different categories:
Below you will find tables of all Pycom products. These tables illustrate the functionality of our various products, their compatibility with each other, as well as what accessories are required to utilise certain functionality.
| Module | WiFi | Bluetooth | LoRa | Sigfox | LTE CAT-M1NB-IoT |
| Module | WiFi | Bluetooth | LoRa | Sigfox | LTE CAT-M1 NB-IoT |
| :--- | :---: | :---: | :---: | :---: | :---: |
| [WiPy 3.0](/datasheets/development/wipy3) | ✔ | ✔ | | | |
| [SiPy](/datasheets/development/sipy) | ✔ | ✔ | | ✔ | |
@@ -50,7 +50,7 @@ Below you will find tables of all Pycom products. These tables illustrate the fu
| Accessory | Expansionboard | Pygate | Pytrack / Pysense | Battery Size |
| :--- | :--- | :--- | :--- | :--- |
[Pycase](https://pycom.io/product/pycase-clear/) | ✔ | #10004; | | small |
[Pycase](https://pycom.io/product/pycase-clear/) | ✔ | ✔ | | small |
[Pygate case](https://pycom.io/product/pygate-case/) | ✔ | ✔ | | tiny |
[Small IP67 Case](https://pycom.io/product/ip67-case-for-pysense-pytrack/) | | | ✔| 18650 |
[Universal IP76 Case](https://pycom.io/product/universal-ip67-case/) | ✔ | ✔ | ✔| 18650 |
[Universal IP76 Case](https://pycom.io/product/universal-ip67-case/) | ✔ | ✔ | ✔| 18650 |

View File

@@ -3,11 +3,152 @@ title: "Pybytes library API"
aliases:
---
To test the Pybytes library API, connect your device to Pymakr and call the methods listed below.
You can use the Pybytes library API in your MicroPython project.
The Pybytes library is positioned in the [frozen](/advance/frozen/) section of the firmware.
It can be imported like regular modules:
```python
from _pybytes import Pybytes
from _pybytes_config import PybytesConfig
conf = PybytesConfig().read_config()
pybytes = Pybytes(conf)
pybytes.start()
```
Or on boot
```python
import pycom
import machine
pycom.pybytes_on_boot(True)
machine.reset()
```
### Debugging
## Provisioning
### Pybytes.activate(activationstring)
Provision the device to Pybytes. Use the `activationstring` provided in Pybytes to activate the device.
### pybytes.read_config([filename='/flash/pybytes_config.json', reconnect=False])
Load the Pybytes configuration file. By default, this is found in `/flash/pybytes_config.json`
### pybytes.update_config(key, [value=None, permanent=True, silent=False, reconnect=False])
Update a `key` and `value` of the default configuration file. additional options:
* `permanent`: will call `pybytes.write_config()`. If set `False`, the new value will not be stored in the configuration file and only used this session.
* `silent`: set `silent` to `True` to not print to REPL.
* `reconnect`: calls `pybytes.reconnect()`
### pybytes.set_config([key=None, value=None, permanent=True, silent=False, reconnect=False])
Same as `update_config(...)`
### pybytes.write_config([file='/flash/pybytes_config.json', silent=False])
Writes the updated configuration to the default configuration file. The parameters:
* `file`: The file name and location
* `silent`: set `silent` to `True` to not print to REPL.
### pybytes.print_config()
Print the configuration settings to the REPL.
## Connection
### pybytes.connect()
Connect the device to Pybytes following the loaded configuration file. You will need to load a configuration file before calling this. If you are using the WiFi or LTE connection, and it is already available, Pybytes will use the existing connection.
### pybytes.start([autoconnect=True])
Same as `pybytes.connect()`, with the option to set `autoconnect`. Setting `autoconnect` to `False` will not start the connection immediately.
### pybytes.enable_lte(carrier=None, cid=None, band=None, apn=None, type=None, reset=None, fallback=False)
Enable the LTE connection to pybytes. Enter the paramters you would normally enter for a LTE connection.
### pybytes.connect_lte()
Connect to Pybytes using LTE and the settings from the configuration file.
### pybytes.connect_wifi()
Connect to Pybytes using WiFi and the settings from the configuration file.
### pybytes.connect_sigfox()
Connect to Pybytes using SigFox and the settings from the configuration file.
### pybytes.connect_lora_otaa([timeout=120, nanogateway=False])
Connect to Pybytes using LoRa OTAA and the settings from the configuration file.
### pybytes.connect_lora_abp([timeout, nanogateway=False])
Connect to Pybytes using LoRa ABP and the settings from the configuration file.
### pybytes.disconnect()
Disconnect from Pybytes gracefully. Closes the MQTT connection and socket.
### pybytes.reconnect()
Calls `pybytes.disconnect()` followed by `pybytes.connect()`
### pybytes.isconnected()
Returns the connection status to Pybytes, can be `True` or `False`.
### pybytes.is_connected()
Same as `pybytes.isconnected()`
### pybytes.enable_ssl()
Enable SSL on the Pybytes connection
>Note that SSL might not be supported by your LTE connection
### pybytes.dump_ca([file='/flash/cert/pycom-ca.pem'])
Write SSL certificate to file.
## Signals
### pybytes.send_signal(signal_number, value)
Send a signal to Pybytes. Arguments are:
* `signal_number`: The signal number in Pybytes, can be any value between 0-254 (255 is reserved)
* `value`: The value you want to send, this can be any type.
> This will also work in Pymesh.
### pybytes.send_ping_message()
Sends a ping (is-alive) message to Pybytes.
### pybytes.send_info_message()
Send an info message to Pybytes containing the device type and firmware version.
### pybytes.send_battery_level(battery_level)
Sends the battery level to Pybytes. The argument `battery_level` can be any integer.
## Miscellaneous
### pybytes.deepsleep(ms, [pins=None, mode=None, enable_pull=None])
See [machine.deepsleep()](/firmwareapi/pycom/machine/#machinedeepsleeptime_ms) for more details. Additionally, this method disconnects from Pybytes gracefully. The optional arguments operate [machine.pin_sleep_wakeup()](/firmwareapi/pycom/machine/#machinepin_sleep_wakeuppins-mode-enable_pull)
### pybytes.smart_config()
Allows for the usage of `smart_config()`, see `pycom.smart_config()` for more information [here](/firmwareapi/pycom/pycom/#pycomsmart_config_on_bootboolean)
## Debugging
Enable debugging if you are having any issues.
There are multiple debug levels, the lowest is 0 which is for warnings only and 99 is the highest used and will print more debugging messages
@@ -24,56 +165,3 @@ There are multiple debug levels, the lowest is 0 which is for warnings only and
>> pycom.nvs_set('pybytes_debug', 99)
```
# API List
* [Activate](activate)
* [Connect](connect_device)
* [Connect LTE](connect_lte)
* [Connect LoRa ABP](connect_lora_abp)
* [Connect LoRa OTAA](connect_lora_otaa)
* [Connect Sigfox](connect_sigfox)
* [Connect Wifi](connect_wifi)
* [Deepsleep](deepsleep)
* [Disconnect](disconnect)
* [Dump CA](dump_ca)
* [Enable LTE](enable_lte)
* [Enable SSL](enable_ssl)
* [Enable terminal](enable_terminal)
* [Export configuration](export_config)
* [Get configuration](get_config)
* [Is connected](is_connected)
* [Print configuration](print_config)
* [Read configuration](read_config)
* [Reconnect](reconnect)
* [Send info message](send_info_message)
* [Send ping message](send_ping_message)
* [Send signal](send_signal)
* [Set configuration](set_config)
* [Start](start)
* [Update configuration](update_config)

View File

@@ -1,39 +0,0 @@
---
title: "Activate Device"
aliases:
- pybytes/api/activate.html
- pybytes/api/activate.md
---
Activate device on Pybytes, via Pymakr plugin.
**Method**
----
**pybytes.activate(activation_string)**
**Parameters**
----
| name | Description | is Required | Default value
| ------------- |:-------------:|:-------------:|:-------------:|
| activation string | Generated by Pybytes | Yes | - |
**Example**
----
`pybytes.activate("eyJhIjoiNTYzM...")`
**Success Response**
----
```
>> Please wait while we try to connect to Pycom
>> Wifi connection established... activating device!
>> WMAC: 807D3AC325E8
>> Firmware: 1.20.1.r2
>> Pybytes: 1.3.0
>> Initialized watchdog for WiFi and LTE connection with timeout 1260000 ms
>> WiFi connection established
>> Pybytes connected successfully (using the built-in pybytes library)
```

View File

@@ -1,36 +0,0 @@
---
title: "Connect Device"
aliases:
- pybytes/api/connect
---
Initialize connection based on the configured parameters.
**Method**
----
**pybytes.connect()**
**Example**
----
`pybytes.connect()`
**Success Response**
----
WiFi:
```
>> Connecting with SSID and PASSWORD
>> WiFi connection established
```
LTE:
```
>> LTE connection established
```
LoRa ABP:
```
>> Trying to join LoRa.ABP for 15000 seconds...
>> Setting up LoRa socket...
>> Connected using LoRa
```

View File

@@ -1,31 +0,0 @@
---
title: "Connect LoRa ABP"
aliases:
- pybytes/api/connect_lora_abp
---
Initialize LoRa ABP connection.
**Method**
----
**pybytes.connect_lora_abp(timeout, nanogateway)**
**Parameters**
----
| name | Description | is Required | Default value
| ------------- |:-------------:|:-------------:|:-------------:|
| timeout | Connection timeout | Yes | - |
| nanogateway | Enable nanogateway | Yes | - |
**Example**
----
`pybytes.connect_lora_abp(15000, false)`
**Success Response**
----
```
>> Trying to join LoRa.ABP for 15000 seconds...
>> Setting up LoRa socket...
>> Connected using LoRa
```

View File

@@ -1,31 +0,0 @@
---
title: "Connect LoRa OTAA"
aliases:
- pybytes/api/connect_lora_otaa
---
Initialize LoRa OTAA connection.
**Method**
----
**pybytes.connect_lora_otaa(timeout, nanogateway)**
**Parameters**
----
| name | Description | is Required | Default value
| ------------- |:-------------:|:-------------:|:-------------:|
| timeout | Connection timeout | Yes | - |
| nanogateway | Enable nanogateway | Yes | - |
**Example**
----
`pybytes.connect_lora_otaa(timeout=15, nanogateway=False)`
**Success Response**
----
```
>> Trying to join LoRa.OTAA for 15 seconds...
>> Setting up LoRa socket...
>> Connected using LoRa
```

View File

@@ -1,29 +0,0 @@
---
title: "Connect LTE"
aliases:
- pybytes/api/connect_lte
---
Initialize watchdog for WiFi and LTE connection.
**Method**
----
**pybytes.connect_lte(reconnect=True, check_interval=0.5)**
**Parameters**
----
| name | Description | is Required | Default value
| ------------- |:-------------:|:-------------:|:-------------:|
| reconnect | Boolean | Yes | - |
| check_interval | interval in seconds | Yes | - |
**Example**
----
`pybytes.connect_lte(reconnect=True, check_interval=0.5)`
**Success Response**
----
```
>> LTE connection established
```

View File

@@ -1,22 +0,0 @@
---
title: "Connect Sigfox"
aliases:
- pybytes/api/connect_sigfox
---
Initialize Sigfox connection.
**Method**
----
**pybytes.connect_sigfox()**
**Example**
----
`pybytes.connect_sigfox()`
**Success Response**
----
```
>> Connected using Sigfox. Only upload stream is supported
```

View File

@@ -1,19 +0,0 @@
---
title: "Connect Wifi"
aliases:
- pybytes/api/connect_wifi
---
Initialize watchdog for the WiFi and LTE connection.
**Method**
----
**pybytes.connect_wifi()**
**Success Response**
----
```
>> Connecting with SSID and PASSWORD
>> WiFi connection established
```

View File

@@ -1,34 +0,0 @@
---
title: "Deepsleep"
aliases:
- pybytes/api/deepsleep
---
Start deepsleep mode for the given period
**Method**
----
**pybytes.deepsleep(ms, pins, mode, enable_pull)**
**Parameters**
----
| name | Description | is Required | Default value
| ------------- |:-------------:|:-------------:|:-------------:|
| ms | Sleep period in ms | Yes | - |
| pins | A list or tuple containing the GPIO to setup for deepsleep wakeup | No | None |
| mode | Configure how GPIOs can wake up -> **machine.WAKEUP_ALL_LOW** or **machine.WAKEUP_ANY_HIGH** | No | None |
| enable_pull | If set to **True** keeps the pull up or pull down resistors enabled during deep sleep | No | None |
**Example**
----
`>> pybytes.deepsleep(1000)`
**Success Response**
----
After deepsleep, the device reconnects.
```
>> Connecting with SSID and PASSWORD
>> WiFi connection established
```

View File

@@ -1,22 +0,0 @@
---
title: "Disconnect"
aliases:
- pybytes/api/disconnect
---
Disconnect device
**Method**
----
**pybytes.disconnect()**
**Success Response**
----
```
>> Watchdog timeout has been increased to 2147483647 ms
>> self.__connection_status=1 | self.__network_type=0
>> MQTT over WIFI||LTE... disconnecting MQTT
>> Packet sent. (Length: 2)
>> Connected over WIFI... disconnecting
```

View File

@@ -1,29 +0,0 @@
---
title: "Dump CA"
aliases:
- pybytes/api/dump_ca
---
Make a dump_ca
**Method**
----
**pybytes.dump_ca(ca_file)**
**Parameters**
----
| name | Description | is Required | Default value
| ------------- |:-------------:|:-------------:|:-------------:|
| ca_file | File path | No | /flash/cert/pycom-ca.pem |
**Example**
----
`pybytes.dump_ca(ca_file='/flash/cert/pycom-ca.pem')`
**Success Response**
----
```
>> Successfully created /flash/cert/pycom-ca.pem
```

View File

@@ -1,36 +0,0 @@
---
title: "Enable LTE"
aliases:
- pybytes/api/enable_lte
---
Enable LTE connection
**Method**
----
**pybytes.enable_lte(carrier, cid, band, apn, type, reset, fallback)**
**Parameters**
----
| name | Description | is Required | Default value
| ------------- |:-------------:|:-------------:|:-------------:|
| carrier | Carrier | No | None |
| cid | Cid | No | None |
| band | Band | No | None |
| apn | APN | No | None |
| type | Type | No | None |
| reset | Reset | No | None |
| fallback | If **True** extends network preferences with the given LTE information| No | False |
**Example**
----
`pybytes.enable_lte('standard', 1, 8, 'soracom.io', 'IP', False)`
**Success Response**
----
```
>> Pybytes configuration written to /flash/pybytes_config.json
>> Watchdog timeout has been increased to 2147483647 ms
>> Initialized watchdog for WiFi and LTE connection with timeout 1260000 ms
```

View File

@@ -1,29 +0,0 @@
---
title: "Enable SSL"
aliases:
- pybytes/api/enable_ssl
---
Enable SSL
**Method**
----
**pybytes.enable_ssl(ca_file, dump_ca)**
**Parameters**
----
| name | Description | is Required | Default value
| ------------- |:-------------:|:-------------:|:-------------:|
| ca_file | File Path | No | /flash/cert/pycom-ca.pem |
| dump_ca | Dump_ca | No | Yes |
**Example**
----
`pybytes.enable_ssl('/flash/cert/pycom-ca.pem', True)`
**Success Response**
----
```
>> Please reset your module to apply the new settings
```

View File

@@ -1,15 +0,0 @@
---
title: "Enable Terminal"
aliases:
- pybytes/api/enable_terminal
---
Enable Terminal
**Method**
----
**pybytes.enable_terminal()**
**Example**
----
`pybytes.enable_terminal()`

View File

@@ -1,28 +0,0 @@
---
title: "Export configuration file"
aliases:
- pybytes/api/export_config
---
Exports all configuration data into a file at specified path.
**Method**
----
**pybytes.export_config(file)**
**Parameters**
----
| name | Description | is Required | Default value
| ------------- |:-------------:|:-------------:|:-------------:|
| file | File Path | No | /flash/pybytes_config.json |
**Example**
----
`pybytes.export_config()`
**Success Response**
----
```
>> Pybytes configuration exported to /flash/pybytes_config.json
```

View File

@@ -1,64 +0,0 @@
---
title: "Get configuration"
aliases:
- pybytes/api/get_config
---
Returns configuration data.
**Method**
----
**pybytes.get_config(key)**
**Parameters**
----
| name | Description | is Required | Default value
| ------------- |:-------------:|:-------------:|:-------------:|
| Key | Returns a specific key-value | No | None |
**Example**
----
`pybytes.get_config()`
**Success Response**
----
```json
{
'ssl': True,
'wifi': {
'ssid': 'SSID',
'password': 'PASSWORD'
},
'lte': {
'apn': 'apn',
'cid': 999,
'reset': False,
'carrier': 'carrier',
'band': 999,
'type': 'type'
},
'username': 'user@email.com',
'network_preferences': ['lte', 'lora_otaa'],
'cfg_msg': 'Pybytes configuration read from file.json',
'dump_ca': True,
'wlan_antenna': 0,
'server': 'xx.x.x.xx',
'lora': {
'otaa': {
'app_key': 'app_key',
'app_device_eui': 'app_device_eui',
'app_eui': 'app_eui'
}
},
'ota_server': {
'port': 999,
'domain': 'software.pycom.io'
},
'pybytes_autostart': True,
'ssl_params': {
'ca_certs': 'ca_certs'
},
'device_id': 'device_id'
}
```

View File

@@ -1,24 +0,0 @@
---
title: "Pybytes library API"
aliases:
- pybytes/api/is_connected
---
**Is connected**
----
Returns true if connected.
**Method**
----
**pybytes.is_connected()**
**Example**
----
`pybytes.is_connected()`
**Success Response**
----
```
>> True
```

View File

@@ -1,22 +0,0 @@
---
title: "Is connected"
aliases:
- pybytes/api/isconnected
---
Returns true if connected.
**Method**
----
**pybytes.isconnected()**
**Example**
----
`pybytes.isconnected()`
**Success Response**
----
```
>> True
```

View File

@@ -1,35 +0,0 @@
---
title: "Print config"
aliases:
- pybytes/api/print_config
---
Prints the current configuration in the terminal.
**Method**
----
**pybytes.print_config()**
**Example**
----
`pybytes.print_config()`
**Success Response**
----
```
>> ssl = True
>> wifi = {'ssid': '', 'password': ''}
>> lte = {'apn': 'apn', 'cid': 999, 'reset': False, 'carrier': 'carrier', 'band': 999, 'type': 'type'}
>> username = user@email.com
>> network_preferences = ['lte', 'lte', 'lte', 'lora_otaa']
>> cfg_msg = Pybytes configuration read from file.json
>> dump_ca = True
>> wlan_antenna = 0
>> server = xx.x.x.xx
>> lora = {'otaa': {'app_key': 'app_key', 'app_device_eui': 'app_device_eui', 'app_eui': 'app_eui'}}
>> ota_server = {'port': 000, 'domain': 'domain.com'}
>> pybytes_autostart = True
>> ssl_params = {'ca_certs': 'ca_certs'}
>> device_id = device_id
```

View File

@@ -1,29 +0,0 @@
---
title: "Read configuration"
aliases:
- pybytes/api/read_config
---
Reads the configuration from the given file.
**Method**
----
**pybytes.read_config(file', reconnect)**
**Parameters**
----
| name | Description | is Required | Default value
| ------------- |:-------------:|:-------------:|:-------------:|
| file | File Path | No | /flash/pybytes_config.json |
| reconnect | Reconnect after changes | No | False |
**Example**
----
`pybytes.read_config()`
**Success Response**
----
```
>> Pybytes configuration read from /flash/pybytes_config.json
```

View File

@@ -1,24 +0,0 @@
---
title: "Reconnect"
aliases:
- pybytes/api/reconnect
---
Reconnects device.
**Method**
----
**pybytes.reconnect()**
**Example**
----
`pybytes.reconnect()`
**Success Response**
----
After the device disconnects:
```
>> Connecting with SSID and PASSWORD
>> WiFi connection established
```

View File

@@ -1,15 +0,0 @@
---
title: "Send information message"
aliases:
- pybytes/api/send_info_message
---
Send information message.
**Method**
----
**pybytes.send_info_message()**
**Example**
----
`pybytes.send_info_message()`

View File

@@ -1,15 +0,0 @@
---
title: "Send ping message"
aliases:
- pybytes/api/send_ping_message
---
Send ping message.
**Method**
----
**pybytes.send_ping_message()**
**Example**
----
`pybytes.send_ping_message()`

View File

@@ -1,28 +0,0 @@
---
title: "Send signal"
aliases:
- pybytes/api/send_signal
---
Send signal to the given signal number.
**Method**
----
**pybytes.send_signal(pin, value)**
**Parameters**
----
| name | Description | is Required | Default value
| ------------- |:-------------:|:-------------:|:-------------:|
| pin | pin | Yes | - |
| value | signal value | Yes | - |
**Example**
----
`pybytes.send_signal(13,25)`
**Success Response**
---
```
To check the result, look at Pybytes → Device → Data
```

View File

@@ -1,32 +0,0 @@
---
title: "Set configuration"
aliases:
- pybytes/api/set_config
---
Set device configuration.
**Method**
----
**pybytes.set_config(key, value, permanent, silent, reconnect)**
**Parameters**
----
| name | Description | is Required | Default value
| ------------- |:-------------:|:-------------:|:-------------:|
| key | key | Yes | None |
| value | value | No | None |
| permanent | boolean | No | True |
| silent | boolean | No | False |
| reconnect | boolean | No | False |
**Example**
----
`pybytes.set_config(key="network_preferences", value="wifi", permanent=True, silent=False, reconnect=False)`
**Success Response**
----
```
>> Pybytes configuration written to /flash/pybytes_config.json
```

View File

@@ -1,28 +0,0 @@
---
title: "Send custom message callback"
aliases:
- pybytes/api/set_custom_message_callback
---
Sends custom message callback.
**Method**
----
**pybytes.set_custom_message_callback(callback)**
**Parameters**
----
| name | Description | is Required | Default value
| ------------- |:-------------:|:-------------:|:-------------:|
| callback | function | Yes | - |
**Example**
----
`pybytes.set_custom_message_callback(print("Hello Pycom!"))`
**Success Response**
----
```
>> Hello Pycom!
```

View File

@@ -1,27 +0,0 @@
---
title: "Start"
aliases:
- pybytes/api/start
---
Opens the Pybytes library.
**Method**
----
**pybytes.start()**
**Example**
----
`pybytes.start()`
**Success Response**
----
```
>> WMAC: 807D3AC325E8
>> Firmware: 1.20.1.r2
>> Pybytes: 1.3.0
>> Initialized watchdog for WiFi and LTE connection with timeout 1260000 ms
>> WiFi connection established
>> Pybytes connected successfully (using the built-in pybytes library)
```

View File

@@ -1,30 +0,0 @@
---
title: "Update configuration"
aliases:
- pybytes/api/update_config
---
Update device configuration parameters.
**Method**
----
**pybytes.update_config(key, value, permanent, silent, reconnect)**
**Parameters**
----
| name | Description | is Required | Default value
| ------------- |:-------------:|:-------------:|:-------------:|
| key | key | Yes | None |
| value | value | No | None |
| permanent | boolean | No | True |
| silent | boolean | No | False |
| reconnect | boolean | No | False |
**Example**
----
`pybytes.update_config(key="wifi", value={'password': 'Pa$$w0rd'}, permanent=True, silent=False, reconnect=False)`
**Success Response**
----
Pybytes configuration written to /flash/pybytes_config.json

View File

@@ -0,0 +1,88 @@
---
title: "Pymakr Online"
aliases:
- pymakr-online/introduction
---
On this page, we discuss the functionality of Pymakr Online.
## What is Pymakr Online?
Pymakr Online is an online IDE for your MicroPython projects. We brought our Pymakr Plugin for Atom and Visual Studio code into Pybytes as an IDE, so you won't necessarily need to have those code editors installed anymore in order to work with your Pycom devices.
## What does Pymakr Online offer you?
* Everything you would expect from a code editor: syntax highlighting, auto complete, multi tabs, file tree, search box etc.
* REPL terminal
* Import from multiple sources (blank/device/project/Github repository), export to a zip file/device/project
* Device activity indicator: track what's going between Pymakr Online and your device.
## Let's get started!
There are two ways in which you can use Pymakr online.
1. Go to [your device](https://pybytes.pycom.io/devices) and select the `Pymakr Online` tab. This method allows you to make quick changes to the Python code on your device and upload it. This is the method we use below.
![](/gitbook/assets/pybytes/pymakr-online/opening-pymakr-device.png)
2. Start a new project on the [Pymakr](https://pybytes.pycom.io/pymakr) tab in Pybytes. There are several different types you can choose from, including a link to your Github repository! Later, we can link the project to a release.
![](/gitbook/assets/pybytes/pymakr-online/opening-pymakr-project.png)
## Using Pymakr Online
1. When you open Pymakr Online, you will see the following
![](/gitbook/assets/pybytes/pymakr-online/initial.png)
* On the left we see the files. Depending on where you started, the online environment will first load with the files you last used. If the device is online, it will automatically try to `Refresh Hierarcy` and synchronise the content. You can click the `Refresh Hierarcy` icon next to your device name to manually update the online filestructure. The online editor will automatically try to connect.
* In the top right, the connection status is displayed. Every so often, you will see a ping being sent out to the device to check if it is still connected. If you started pymakr from a project, you will also see the `Save/Export` button here as well.
* And finally, on the bottom, the REPL is displayed, this works exactly the same as the REPL you are used to in VSCode or Atom. Everything you type in there will be duplicated to the REPL over USB.
2. Open the `main.py` file, or, when not available, create one by right clicking on the device name to `Create File`. Here, we can write our own python code in the main editor. You can use the example we added below to try it out.
![](/gitbook/assets/pybytes/pymakr-online/open-file.png)
```python
import pycom
import time
pycom.heartbeat(False)
while(True):
pycom.rgbled(0xAA0000)
time.sleep(0.5)
pycom.rgbled(0xAA00AA)
time.sleep(0.5)
pycom.rgbled(0x00AA00)
time.sleep(0.5)
```
3. After adding the code, a `Save and Upload` button will appear (or you can use the `Save/Export` button already present), allowing you to upload code to the device. Clicking this will upload and reboot the device. The device will restart and go offline for a second. Then come back online and show the RGB LED blinking in three different colors.
![](/gitbook/assets/pybytes/pymakr-online/upload.png)
>Note that if you make a syntax error, the device will come back online but not throw any error in the REPL.
## Creating a Project
1. Now that you know how to use the Pymakr Online environment, we can create a project (if you have not already). If you just followed the example above, go to the [Pymakr](https://pybytes.pycom.io/pymakr#) tab and click on `Import from Existing Device`.
![](/gitbook/assets/pybytes/pymakr-online/starting-project.png)
2. Select your device and either `Retrieve from Cloud` or `Request from device`, depending on where the latest version of your code is. This will load the hierarchy and bring up the Pymakr Online interface.
3. Make your changes and then click the `Save/Export` button, this offers three options. This time, we use `Include in Release`. It will ask us to create a new project, or add to an already existing project.
![](/gitbook/assets/pybytes/pymakr-online/new-project.png)
4. Assuming you have not create a project yet, creat a new one, and name it `My first project` and click next.
![](/gitbook/assets/pybytes/pymakr-online/new-project1.png)
5. Here, it asks for the networks we want to use. For now, lets select WiFi.
![](/gitbook/assets/pybytes/pymakr-online/new-project1.png)
6. In the next screen, it asks for the WiFi network you want to use, select the one that is most convenient for you.
7. Now that we have successfully create a project. Using projects, you can add unlimited devices and keep them all up-to-date Over The Air (OTA) with new Pybytes configuration files, Python code or update the firmware.

View File

@@ -0,0 +1,10 @@
---
title: "How to Open Pymakr Online"
aliases:
- pymakr-online/how-to-open.html
- pymakr-online/how-to-open.md
- pymakr-online/how-to-open
---
## The two different ways of opening Pymakr Online

View File

@@ -0,0 +1,185 @@
---
title: "Tools/Features"
aliases:
- pymakr/toolsfeatures.html
- pymakr/toolsfeatures.md
- chapter/pymakr/toolsfeatures
---
There are two different ways of opening Pymakr Online. Each way has some differences on the features and purposes. Read more at [How to Open Pymakr Online](/pymakr-online/how-to-open)
# Pymakr Online linked to a device
If you open Pymakr Online from a device page, Pymakr will be linked to that device.
_**Note: Your device needs to be online in order to be reachable by Pymakr Online**_
## Terminal
Just like Pymakr Plugin, Pymakr Online also has a REPL (Read Evaluate Print Line) terminal. The REPL allows you to run code on your device, line by line. To begin coding, open Pymakr from a device (device's page > pymakr tab > open Pymakr button), go to the terminal and start typing your code.
## Download a file
When Pymakr is loaded, the IDE will request the device its hierarchy (the folder structure). If you open a file that has never been opened in Pymakr Online before, that file's content will be downloaded and saved on the cloud, so the next time you open that same file, the content download won't be necessary, unless you want to. Maybe you changed that file's content in somewhere else and want to force a download to get the current content which is in the device.
To download the file from the linked device, click on the download icon next to the file name at file tree.
![](/gitbook/assets/pymakr-online/pymakr-download-icon.jpg)
That will download the file content from the device and save it into the cloud.
![](/gitbook/assets/pymakr-online/last-update-one-day-ago.jpg)
*In this case, that file has been updated yesterday.*
![](/gitbook/assets/pymakr-online/last-update-few-seconds-ago.jpg)
*After downloading the main.py content from the device.*
## Upload a file
After making any changes in a file, you will be able to upload it into your device by clicking on "Save and Upload" link.
![](/gitbook/assets/pymakr-online/save-upload.jpg)
_**Note: That will upload only the current file.**_
After downloading or uploading a file, its content is stored on the cloud.
## Update Hierarchy
If you want to refresh your device's hierarchy in Pymakr, you should click on Refresh Hierarchy icon next to your device name. That will request the hierarchy from the device, creating or deleting folders according to your device's file hierarchy.
![](/gitbook/assets/pymakr-online/pymakr-hierarchy.jpg)
# Pymakr Online not linked to a device
Pymakr Online can be opened without being linked to a device, from [Pymakr Online](https://www.pybytes.pycom.io/pymakr) initial page.
Since there's no device linked in this way of opening Pymakr Online, there are no device related actions here (download file, device activity indicator etc). Instead, you decide what you are going to do with your code: upload to a project, download a zip file or upload to a device.
Before exporting your project, you first need to import a project into Pymakr or start with a blank project:
## Import code into Pymakr Online
![](/gitbook/assets/pymakr-online/pymakr-online-initial-page.jpg)
*Pymakr Online initial page*
### 1. Blank project
This will open Pymakr Online with the essential files of MicroPython project (main.py and boot.py).
### 2. Project/Release
1. After clicking on Project button, you will see this page, where you must choose one project:
![](/gitbook/assets/pymakr-online/pymakr-projects.jpg)
2. And finally, choose the release you want to work with. That will open Pymakr with the files of the selected release.
![](/gitbook/assets/pymakr-online/pymakr-releases.jpg)
### 3. Device
At this section you can import the code from a device and work with it in Pymakr Online. Note this won't have any connection to any device once it's loaded.
1. Choose the device you want to work with:
![](/gitbook/assets/pymakr-online/pymakr-devices.jpg)
2. If you already worked with that device in Pymakr Online, you can use the latest saved code on the cloud, so the device doesn't need to be online, or even turned on. That will instantly open Pymakr with that code.
![](/gitbook/assets/pymakr-online/pymakr-device-import-1.jpg)
If you want the current files from the device and you are not sure if the saved code on the cloud is up to date, you can download those files from the device by clicking on "Request files from device" button. That will bring you to another modal, which will show you the download progress.
![](/gitbook/assets/pymakr-online/pymakr-device-import-2.jpg)
Once the download has been completed, you can now work with the device's files in Pymakr Online:
![](/gitbook/assets/pymakr-online/pymakr-device-import-3.jpg)!
### 4. Zip file
This feature allows you to upload a zip file of your project into Pymakr Online and start to work with it from there. The zip file can not be bigger than 4MB.
### 5. Github Repository
1. Firstly, type the repository name you want to import your code from and press enter:
![](/gitbook/assets/pymakr-online/pymakr-github-import-1.jpg)!
2. Then select your repository by clicking on it.
![](/gitbook/assets/pymakr-online/pymakr-github-import-2.jpg)!
3. Select the branch
![](/gitbook/assets/pymakr-online/pymakr-github-import-3.jpg)!
4. Wait for a few seconds until the download of the files from the selected branch is completed and then you can start working on Pymakr with those files!
![](/gitbook/assets/pymakr-online/pymakr-github-import-4.jpg)!
_**Note: There's a usage limit of the Github API. You won't be able to search a lot and select different repositories in the same day. Use this feature with moderation.**_
## Save/Export
To export your project, ensure that you have opened Pymakr Online from the Pymakr initial page (accessible from the sidebar menu) and not from the device page. For any option here, the size limit is 4MB.
1. Click on Save/Export button.
![](/gitbook/assets/pymakr-online/pymakr-export.jpg)
2. Choose an option:
![](/gitbook/assets/pymakr-online/pymakr-export-modal.png)
* Upload to a project will be released soon.
* Create and Download a zip file from all of the files from your project.
![](/gitbook/assets/pymakr-online/pymakr-download-zip.jpg)
* You can also export to a device. This modal will open after clicking on "UPLOAD TO DEVICE" button. Note that your device needs to be online in order to receive the files from Pymakr Online.
![](/gitbook/assets/pymakr-online/pymakr-devices-list.jpg)
* Wait while Pymakr Online is uploading your project to the selected device.
![](/gitbook/assets/pymakr-online/pymakr-upload.jpg)
* Once the upload is done, your device will restart and load the new code.
![](/gitbook/assets/pymakr-online/pymakr-download-completed.jpg)
# Create a new file or folder
To create a file or folder in Pymakr Online, disregarding of how you opened it, you just need to right click on the folder you want to create the file or folder in.
![](/gitbook/assets/pymakr-online/pymakr-create-folder.jpg)
In this case, I'm creating a folder called 'new-folder' under the project root. For that, I right clicked on the project name.
Now type the name of the file/folder:
![](/gitbook/assets/pymakr-online/pymakr-create-folder-1.jpg)
_**Note: Pymakr Online only supports the formats .py .txt .log .json .html .js .cet .crt**_
_**A folder name can not contain dots (.)**_
If you want to delete a folder or file, right click on the item to be deleted and then click on "Delete file" or "Delete folder".
![](/gitbook/assets/pymakr-online/pymakr-create-folder-2.jpg)

View File

@@ -0,0 +1,5 @@
---
title: "Pymakr Online"
---
On this page, we discuss the

Binary file not shown.

View File

@@ -67,4 +67,9 @@ time.sleep(3)
py.setup_sleep(10)
py.go_to_sleep()
"""
```
```
## Alternative Libraries
* [micropyGPS](https://github.com/inmcm/micropyGPS)
* [Alternative L76GNSS module](https://github.com/andrethemac/L76GLNSV4/blob/master/L76GNSV4.py)

View File

@@ -8,7 +8,7 @@ The following tutorial demonstrates the use of the LTE CAT-M1 and NB-IoT functio
> Before you start, make sure that your Simcard is registered and activated with your carrier.
When using the SigFox network, **Always** connect the appropriate LoRa antenna to your device. See the figures below for the correct antenna placement
When using the LTE network, **Always** connect the appropriate antenna to your device. See the figures below for the correct antenna placement.
| Gpy | Fipy |
|---|---|
@@ -17,6 +17,8 @@ When using the SigFox network, **Always** connect the appropriate LoRa antenna t
GPy and FiPy support both LTE CAT-M1 and NB-IoT. These are newer, low power, long range, cellular protocols. They are not the same as the full version of 2G/3G/LTE supported by cell phones, and require your local carriers to support them. At the time of writing, CAT-M1 and NB-IoT connectivity is not widely available so be sure to check with local carriers if support is available where you are. Together with the SIM card, the provider will supply you with configuration details: Usually band and APN. Use these in the example code below.
## Example
```python
from network import LTE
import time
@@ -34,8 +36,8 @@ lte.init()
#also, check the band settings with your carrier
lte.attach(band=20, apn="your apn")
print("attaching..",end='')
while not lte.isattached()
time.delay(0.25)
while not lte.isattached():
time.sleep(0.25)
print('.',end='')
print(lte.send_at_cmd('AT!="fsm"')) # get the System FSM
@@ -58,25 +60,36 @@ The last line of the script should return a tuple containing the IP address of t
>Note: the first time, it can take a long while to attach to the network.
# LTE disconnecting
When the LTE disconnects in an unexpected situation, for example when the signal is lost, `lte.isconnected()` will still return `True`. Currently, there is a solution using the callback and handler function listed below:
## LTE Connectivity loss
> You need firmware 1.20.2.r2 or later for this functionality
It is possible that the LTE modem loses connectivity. It could be due to some radio interference, maybe the reception in the location of the module is not too good. Or if the module is being physically moved to another location with worse reception.
If the connectivity is lost this will in general not be reflected when you check `lte.isconnected()`. However, the lte modem sends a `UART break` signal. You can receive these events by using the `lte_callback` functionality. When connectivity is lost, the modem will try it's best to re-establish connectivity and this also works well in general. When connectivity is re-established, the modem will send another break signal, ie, the `lte_callback` will fire again.
This means the best practice is to capture the callback and inside the callback test whether the module is connected or not. If, with some timeout, there really is no connection, then one can try to react to this. Let's say the application is a sensor, that is most of the time in deepsleep, wakes up once in a while, measures something and then tries to send it's measurement before going back to deepsleep. In this case one could simply log the event, go back to sleep and hope that in the next interval the reception will be better. Or, if there is some alternative connectivity implemented, one could trigger it at this point.
```python
from network import LTE
import time
from sleep import sleep
import machine
def cb_handler(arg):
print("CB: LTE Coverage lost")
print("CB: sleep", s)
print("CB: deinit")
lte.deinit()
print("CB: reset")
machine.reset()
lte.lte_callback(LTE.EVENT_COVERAGE_LOSS, cb_handler)
def lte_cb_handler(arg):
ev = arg.events() # NB: reading the events also clears them
print("LTE CB", time.time(), ev, time.gmtime())
pycom.rgbled(0x222200)
if ev & LTE.EVENT_BREAK:
print("LTE CB", "uart break signal")
print("LTE CB", time.time(), "test connection")
# TBD: write your own test_connection function
if test_connection():
print("LTE CB", time.time(), "connection ok")
else:
print("LTE CB", time.time(), "connection not ok")
# TBD: implement handling of lost connection
# machine.deepsleep(deepsleeptime)
lte_callback(LTE.EVENT_BREAK, lte_cb_handler)
```
# LTE Troubleshooting guide
## LTE Troubleshooting guide

View File

@@ -92,10 +92,9 @@ To enter update mode follow these steps:
3. Remove the development module
4. Press this button on your device:
| Pygate | Pysense / Pytrack | Pysense 2.0 X / Pytrack 2.0 X | Expansionboard |
|:------:|:-----------------:|:-----------------------------:|:--------------:|
| | | | |
| Expansionboard 3.1 | Pygate | Pysense | Pysense 2.0 X | Pytrack | Pytrack 2.0 X | PyScan |
|:----|:----|:-----|:--------|:-----|:-----|:----|
| ![](/gitbook/assets/expansionboards/expansionboard31_dfu.png) | ![](/gitbook/assets/expansionboards/pygate_dfu.png)|![](/gitbook/assets/expansionboards/pysense1_dfu.png)] | ![](/gitbook/assets/expansionboards/pysense2_dfu.png) | ![](/gitbook/assets/expansionboards/pytrack1_dfu.png) | ![](/gitbook/assets/expansionboards/pytrack2_dfu.png) | ![](/gitbook/assets/expansionboards/pyscan_dfu.png) |
5. Plug in the USB cable to the host computer and wait 1 second before releasing the button
6. After this you will have approximately 7 seconds to run the DFU-util tool

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 KiB

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 311 KiB

After

Width:  |  Height:  |  Size: 1.3 MiB