I put together an example which allows JSON data to be sent back and forth:
https://github.com/dhylands/json-ipc
Search found 3628 matches
- Sun Apr 11, 2021 4:32 pm
- Forum: Raspberry Pi microcontroller boards
- Topic: Receive data from PC
- Replies: 2
- Views: 125
- Fri Apr 09, 2021 9:14 pm
- Forum: General Discussion and Questions
- Topic: Why does utime.gmtime() exist?
- Replies: 2
- Views: 125
Re: Why does utime.gmtime() exist?
In the unix version of MicroPython localtime and gmtime don't return the same results.
- Fri Apr 09, 2021 9:11 pm
- Forum: General Discussion and Questions
- Topic: How does file transfer to target device work?
- Replies: 3
- Views: 131
Re: How does file transfer to target device work?
I've also written a script https://github.com/dhylands/upy-example ... e_files.py that takes some files and generates a files.py file. You can then run that on the board using pyboard.py
I think using rshell is easier (disclaimer I wrote rshell).
I think using rshell is easier (disclaimer I wrote rshell).
- Thu Apr 08, 2021 7:17 pm
- Forum: MicroPython pyboard
- Topic: Pyboard.py raw repl : passing Micropython variable to Python
- Replies: 6
- Views: 367
Re: Pyboard.py raw repl : passing Micropython variable to Python
I think you can just call exec_raw_no_follow. However, you probably need to keep track of whether you're in raw-repl mode or not. Since you're not calling follow, you don't know if calling exit_raw_repl will actually work or not. If you call enter_raw_repl again, it will send a Control-C and if the ...
- Wed Apr 07, 2021 6:12 pm
- Forum: MicroPython pyboard
- Topic: pydfu.py run
- Replies: 1
- Views: 226
Re: pydfu.py run
I'm pretty sure that pydfu.py will only work on Linux and MacOS and not on Windows. You'll need to use dfu-util (command line) or one of the GUI based DFU loaders (like DFUse) under windows.
- Wed Apr 07, 2021 6:10 pm
- Forum: MicroPython pyboard
- Topic: Pyboard.py raw repl : passing Micropython variable to Python
- Replies: 6
- Views: 367
Re: Pyboard.py raw repl : passing Micropython variable to Python
"follow" collects output from the downloaded script. rshell calls exec_raw_no_follow, and then calls follow. This allows the host side to interact with the remote side when say transferring files. https://github.com/dhylands/rshell/blob/e2820f679aa06d40c35dbd5c626a0402047e28f8/rshell/main.py#L1610-L...
- Sat Apr 03, 2021 5:05 pm
- Forum: General Discussion and Questions
- Topic: I am at a loss of how to get started??
- Replies: 14
- Views: 471
Re: I am at a loss of how to get started??
You can use pyboard.py (found in micropython/tools) to upload a file into memory and execute it. Something like: pyboard.py -d /dev/ttyACM0 name-of--python-file Note which the RPi Pico and rshell you shouldn't need to specify the port. It should find it automatically. After launching rshell you can ...
- Sat Apr 03, 2021 4:07 pm
- Forum: General Discussion and Questions
- Topic: Problem with rshell running a series of commands
- Replies: 4
- Views: 183
Re: Problem with rshell running a series of commands
I can manually enter rshell and then enter repl and then type import mm1 and get the simple program to run ok. However, if I run the following code, it does'nt work: $rshell repl ~ import mm1 The error message is: unable to find to find board 'home/pi' I am using the default name of the board. What...
- Thu Apr 01, 2021 11:29 pm
- Forum: General Discussion and Questions
- Topic: if statement short circuiting
- Replies: 9
- Views: 401
Re: if statement short circuiting
You could use a lambda function as the value. Something like this: case = { 'a': lambda: print('case a called'), 'b': lambda: print('case b called'), } case['a']() case['b']() case2 = { 'a': lambda x: print('case a called, x =', x), 'b': lambda x: print('case b called, x =', x), } case2['a'](123) ca...
- Thu Apr 01, 2021 10:01 pm
- Forum: Programs, Libraries and Tools
- Topic: Working with binary data
- Replies: 2
- Views: 172
Re: Working with binary data
That's just the way python tries to print strings. It uses ASCII codes whenever it can and only uses the \xXX notation for non-ASCII chars. So the space is 0x20 and @ is 0x40. So this is what you get (even in regular python): >>> bytearray([0x31, 0x32, 0xff, 0x20, 0x40, 0xee]) bytearray(b'12\xff @\x...