Search found 25 matches

by benalb
Fri Jul 16, 2021 1:59 pm
Forum: General Discussion and Questions
Topic: Access HTTP response header
Replies: 2
Views: 1859

Re: Access HTTP response header

I think https://github.com/SpotlightKid/mrequests is what you are looking for, in the examples dir there is a parse_response_headers.py.
by benalb
Thu Apr 22, 2021 4:12 pm
Forum: ESP32 boards
Topic: micropython-nano-gui with m5stickc.
Replies: 2
Views: 1673

Re: micropython-nano-gui with m5stickc.

Given that you are using RGB565 with 16 bit color values I think you want something like this: Thank you very much, Peter. It almost worked, but I have to change the function to: def rgb(g, b, r): return ((r & 0xf8) << 8) | ((g & 0xfc) << 3) | (b >> 3) Note the different order of params, gbr, not r...
by benalb
Wed Apr 21, 2021 12:59 pm
Forum: ESP32 boards
Topic: micropython-nano-gui with m5stickc.
Replies: 2
Views: 1673

micropython-nano-gui with m5stickc.

I'v managed to run nano-gui in the m5stickc with pure micropython, no uiflow firmware. I've copypasted the rgb function def rgb(r, g, b): return (r & 0xe0) | ((g >> 3) & 0x1c) | (b >> 6) from drivers/st7735r.py to https://github.com/lukasmaximus89/M5Stick-C-Micropython-1.12/blob/master/m5stickc_lcd....
by benalb
Tue Jun 12, 2018 6:05 am
Forum: Other Boards
Topic: MCUDev Black STM32F407VET6 + STM32F407ZET6 dev boards
Replies: 167
Views: 301912

Re: Black STM32F407VET6 + STM32F407ZET6 dev boards

http://wiki.stm32duino.com/index.php?title=STM32F407 In here I have found: http://wiki.stm32duino.com/images/2/26/STM32F407VET6_pinoutDiagram.pdf pinout diagram http://wiki.stm32duino.com/images/0/05/Black_STM32f4VET6_Pinouts_Right.pdf Pinouts right side http://wiki.stm32duino.com/images/3/3e/Black...
by benalb
Thu Mar 29, 2018 2:39 pm
Forum: MicroPython pyboard
Topic: how to execute "OTHER" python scripts
Replies: 12
Views: 54566

Re: how to execute "OTHER" python scripts

I usually do this: cat test01.py def my_test(): print("hello, test") def main(): my_test() if __name__ == "__main__": main() and then, can do: >>> import test01 >>> from test01 import my_test >>> >>> test01.my_test() hello, test >>> test01.main() hello, test >>> >>> my_test() hello, test
by benalb
Mon Oct 30, 2017 7:45 pm
Forum: ESP8266 boards
Topic: Load json
Replies: 6
Views: 9256

Re: Load json

SpotlightKid wrote:
Mon Oct 30, 2017 7:13 pm
This should be:
(... do not use readlines)

Code: Select all

with open(filename) as fp:
	data = ujson.load(fp)
I stand corrected. After test the code, I see that ujson.load is the correct way. :oops:
by benalb
Mon Oct 30, 2017 11:05 am
Forum: ESP8266 boards
Topic: Load json
Replies: 6
Views: 9256

Re: Load json

Hi guys, I would like to load some parameters from a json file. I wrote an example: # mqtt.py : import ujson with open('document.json') as data_file: data = ujson.loads(data_file) (...) What i was wrong? The docs says: ujson.loads(str), Parse the JSON str and return an object. Raises ValueError if ...
by benalb
Fri Oct 27, 2017 3:39 pm
Forum: ESP8266 boards
Topic: [SOLVED] Motor shield for NodeMCU
Replies: 9
Views: 18519

Re: Motor shield for NodeMCU

I am trying to run motor shield with NodeMCU (ESP8266 12N), motor shield doc: https://smartarduino.gitbooks.io/user-mannual-for-esp-12e-motor-shield/content/index.html. (...) I've got the same shield, and it works, with this code you can get the idea: from machine import Pin, PWM """ nodemcu pins f...