Pymate not working
-
Hi,
I think I'm doing everything correctly and following Roberto's tutorial to a T.
I am getting errors when I try both reading and writing virtual pins.
I am using a wipy 2.0 running firmware 1.18.2.r4Here Is my process:
- set up pymate
- safe boot device, download files.
- edit pymate_basic.py in lib with code under "# Initialize Virtual Pins and Terminal Pins Here"
- restart, add widgets to app, and it always returns errors. Here are two examples of errors:
a)
When I try Roberto's first example of writing, I add the following code under "# Initialize Virtual Pins and Terminal Pins Here" to pymate_basic.py:
# Initialize Virtual Pins and Terminal Pins Here import pycom def set_led_color(params): val = int(params[0]) if (val < 256): val = val & 0xFF elif (val > 255 and val < 512): val = (val << 8) & 0xFF00 elif (val > 511): val = (val << 16) & 0xFF0000 pycom.rgbled(val) pymate_library.add_virtual_pin(1,None, set_led_color)After uploading, and setting up a widget type slider with pin V1, and range 0-750, I slide the slider and get one of the following errors:
- "Error calling provided virtual method"
2)"Traceback (most recent call last):
File "boot.py", line 39, in <module>
File "/flash/lib/pymate_basic.py", line 25, in <module>
File "/flash/lib/pymate_library.py", line 414, in run
File "/flash/lib/simple.py", line 202, in wait_msg
File "/flash/lib/pymate_library.py", line 352, in _recv_msg_callback
File "/flash/lib/pymate_library.py", line 278, in _handle_hardware_msg
KeyError: 32"
3)Warning: Virtual write to unregistered pin 1
b) When I try Roberto's second example of reading, I add the following code under "# Initialize Virtual Pins and Terminal Pins Here"
from uos import urandom def read_random(): val = int(urandom(1)[0]) return val pymate_library.add_virtual_pin(1,read_random, None)After setting up the widget type to Display, pin V1, pin Mode INPUT, refresh Rate 500ms, I hit play, and I get the following error:
Traceback (most recent call last):
File "boot.py", line 39, in <module>
File "/flash/lib/pymate_basic.py", line 19, in <module>
File "/flash/lib/pymate_library.py", line 414, in run
File "/flash/lib/simple.py", line 202, in wait_msg
File "/flash/lib/pymate_library.py", line 352, in _recv_msg_callback
File "/flash/lib/pymate_library.py", line 278, in _handle_hardware_msg
KeyError: 32Please help. There is very little documentation to go off of, and I can't find anything wrong with what I'm doing.
Thanks
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login