Search found 37 matches

by cgglzpy
Tue Dec 15, 2020 6:37 pm
Forum: Programs, Libraries and Tools
Topic: Writing A Sensor Library/Driver
Replies: 7
Views: 851

Re: Writing A Sensor Library/Driver

There is a nice talk about that: An Introduction to Hardware Drivers in Micro Python To sum up: Understand the datasheet Know how to write/read to/from the sensor registers (it varies a bit depending on the protocol used I2C/SPI/UART) Also understanding bitwise operations, binary/hexadecimal numberi...
by cgglzpy
Tue Oct 27, 2020 6:12 pm
Forum: General Discussion and Questions
Topic: hexadecimal numbers over UART
Replies: 11
Views: 1095

Re: hexadecimal numbers over UART

Hi BL007 What you are looking for is 'struct' see: http://docs.micropython.org/en/latest/library/ustruct.html and https://docs.python.org/3/library/struct.html >>> import struct >>> struct.pack('B', 238) b'\xee' >>> struct.pack('B', 0xEE) b'\xee' To decode >>> struct.unpack('B', b'\xee') (238,) >>> ...
by cgglzpy
Fri Jun 12, 2020 12:26 pm
Forum: ESP8266 boards
Topic: Get large log files from sd card over wifi?
Replies: 3
Views: 829

Re: Get large log files from sd card over wifi?

Hi JonRob, You could try upydev , just follow the instructions in the README and then use sync command , e.g.: $ upydev sync -f logACC_26_6_2019_0_18_42.txt -s sd Note: 1) The SD card should be mounted as 'sd' 2) 20 MB is large so expect at least 2-3 minutes with ideally conditions, or even double w...
by cgglzpy
Fri Apr 10, 2020 4:35 pm
Forum: Programs, Libraries and Tools
Topic: ESP32-targeted alternative to Ampy
Replies: 10
Views: 2226

Re: ESP32-targeted alternative to Ampy

Hi AwesomeCronk, you may be interested to have a look at upydev and upydevice , a CLI and a python library which I made to meet these needs.
by cgglzpy
Fri Mar 27, 2020 5:42 pm
Forum: ESP32 boards
Topic: ESP32 can't get ssl working
Replies: 3
Views: 1104

Re: ESP32 can't get ssl working

Hi kruthers, I think the socket needs to connect or accept a connection before wrapping in SSL, see examples at Micropython repo micropython-examples-network Also for the keywords: # CPython uses key keyfile/certfile arguments, but MicroPython uses key/cert client_s = ssl.wrap_socket(client_s, serve...
by cgglzpy
Thu Feb 20, 2020 8:26 pm
Forum: ESP32 boards
Topic: receive commands from pc and reply with data
Replies: 7
Views: 1336

Re: receive commands from pc and reply with data

Hi aleskeyfedorovich, If you work with jupyter notebooks/ jupyter lab I made a jupyter kernel ( based on previous work jupyter_micropython_kernel and jupyter_micropython_remote ) I created some "magic cell" commands like "%logdata" and "%devplot" to allow exactly this: I have an ESP32 connected to a...
by cgglzpy
Sat Feb 15, 2020 5:49 pm
Forum: General Discussion and Questions
Topic: Remove and Replace Printed characters in serial terminal
Replies: 5
Views: 993

Re: Remove and Replace Printed characters in serial terminal

I don't know if this is the same, but using '\r' and "print(msg, end=' ')" should work. e.g. >> def print_and_clear(msg): ... msg_list = ['This', 'is', 'a', 'message', 'that', 'replaces', 'itself'] ... print(msg, end='') ... time.sleep(1) ... print('\r'+' '*len(msg), end='\r') # This clears previous...
by cgglzpy
Fri Feb 14, 2020 6:08 pm
Forum: ESP32 boards
Topic: socket ssl
Replies: 1
Views: 573

Re: socket ssl

Hi, ke528

Look at this issue in MicroPython repo: https://github.com/micropython/micropython/issues/5543

MicroPython v1.12 stable release should work, so rolling back to last stable version resolves the issue.
by cgglzpy
Thu Feb 06, 2020 3:58 pm
Forum: ESP32 boards
Topic: ADXL345 range setting on micropython
Replies: 3
Views: 828

Re: ADXL345 range setting on micropython

i've insert the suggested lines in the code but nothing happens. Hmm, maybe because of this From the data sheet Page 26 : All data, except that for the ±16 g range, must be clipped to avoid rollover So I think you have to comment or erase the "if x > 32767" lines. Something like this: def xValue(se...
by cgglzpy
Tue Feb 04, 2020 6:38 pm
Forum: ESP32 boards
Topic: ADXL345 range setting on micropython
Replies: 3
Views: 828

Re: ADXL345 range setting on micropython

Hi, You can see this in the data sheet: ADXL345 [Page 26-27] Register 0x31—DATA_FORMAT (Read/Write) --> Range Bits D1-D0 So you need to write to register 0x31 the byte 0x03 which is 0b00000011 (see Table 21) setting bits D1-D0 to 1. In code should be something like: reg_DATA_FORMAT = const(0x31) and...