研究筆記-LoPy
緣起
聽說有個整合了 Wifi, Bluetooth, LoRa 的好東西,所以借來玩玩
Step by Step
- Quick Start - LED color checked
- GPIO check
- Pymakr connected
- Telnet connected (micro/python)
- Boot with your code
- Bluetooth ADV check OK
GPIO Checked
# sample code in the document seems have syntax error, following is good.
import machine
led=machine.Pin("GPIO12",machine.Pin.OUT)
led(1)
Boot with your code
Replace main.py in flash/
- use ftp 192.168.4.1 to upload.
- or add main.py to your project and sync project in PyMakr
network module don’t have Bluetooth. Maybe need upgrade
Upgrade firmware
升級時,電源另外給 5v, 資料還是用 3.3v
FTDI TxD-P0(Rx0), FTDI RxD-P1(Tx0), FTDI GND-GND.
0.9.0.b network module don’t have Bluetooth. 1.1.0.b1 have.
from 0.9.0.b to 1.1.0.b1
>>> import os
>>> print(os.uname().release)
1.1.0.b1
Check Bluetooth Adv
- telnet and UART console hard to use code copy&paste to run python script.
- use PyMakr, run script will be better
- from network import Bluetooth
- import binascii
- bluetooth = Bluetooth()
- bluetooth.start_scan(5)
- while True:
- adv = bluetooth.get_adv()
- if adv:
- # try to the the complete name
- print(bluetooth.resolve_adv_data(adv.data, Bluetooth.ADV_NAME_CMPL))
- # try to get the manufacturer data (Apple’s iBeacon data is sent here)
- #print(binascii.hexlify(bluetooth.resolve_adv_data(adv.data, Bluetooth.ADV_MANUFACTURER_DATA))
Output: CC2650 SensorTa.
Normal console output
- ets Jun 8 2016 00:22:57
- rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
- configsip: 0, SPIWP:0x00
- clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
- mode:QIO, clock div:2
- load:0x3fff9010,len:8
- load:0x3fff9018,len:312
- load:0x40078000,len:2352
- load:0x4009f000,len:1196
- entry 0x4009f2d8
- frc2_timer_task_hdl:3ffd2634, prio:22, stack:2048
- tcpip_task_hdlxxx : 3ffd7154, prio:18,stack:2048
- pp_task_hdl : 3ffdb3c4, prio:23, stack:8192
- mode : softAP(24:0a:c4:00:b4:ff)
- dhcp server start:(ip: 192.168.4.1, mask: 255.255.255.0, gw: 192.168.4.1)
- dhcp server start:(ip: 192.168.4.1, mask: 255.255.255.0, gw: 192.168.4.1)
Try PyMate
- By follow the setup procedure and in PyMate App (iOS), the setup devices always can’t connected. The setup procedure run smoothly. But not working.
- The /flash directory only have main.py, boot.py , Can’t find any additional library and python file which I think there should be have some support files.
- Pymate: Understanding Virtual and Terminal Pins
參考資料
- pycom
- Forum
- MicroPython libraries
- LoPy
- Datasheet
- Expansion Board 2.0
- LoPy PinOut
- Document
- Quickstart guide
- Expansion Board PinOut
- Expansion Board User Manual