Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Simple Simon CircuitPython Version
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Simple Simon CircuitPython Version

by stevelup on Mon May 11, 2020 1:06 pm

The Arduino version works very well, however the CircuitPython version (https://learn.adafruit.com/circuit-play ... on-version) does not work at all. Multiple errors reported when the code is checked in MU Editor.
Perhaps needs to be updated for Python5?

stevelup
 
Posts: 5
Joined: Wed Sep 27, 2017 4:16 pm

Re: Simple Simon CircuitPython Version

by mikeysklar on Mon May 11, 2020 1:54 pm

Hi stevelup,

Are you running the simple simon example on a Circuit Playground Express board?

What errors do you see?

Which version of CircuitPython are you currently running?

mikeysklar
 
Posts: 1995
Joined: Mon Aug 01, 2016 8:10 pm

Re: Simple Simon CircuitPython Version

by stevelup on Mon May 11, 2020 2:05 pm

Yes, running the code on a Circuit Playground Express. Using CircuitPython version 5.3.0 and MU Editor.
The errors shown by MU editor are in two general categories- Too many or too few white spaces before and after : or , etc. and also some invalid operator errors, for instance:
Line 72 of the code if button['freq'] == None:
generates this error message:
Comparison to none should be 'if condition is n one:'

Or this:
if b == 1: return cpx.touch_A1
generates error message: Multiple statements on one line (colon)

Also, while the code for selecting the skill level seems to process ok, anything after that does not seem to work at all. The Arduino version of the code worked flawlessly.

stevelup
 
Posts: 5
Joined: Wed Sep 27, 2017 4:16 pm

Re: Simple Simon CircuitPython Version

by mikeysklar on Mon May 11, 2020 3:46 pm

Stevelup,

Could you try downloading our CPX example as a file to a and dropping it onto the CIRCUITPY drive as code.py file (bypassing the MU editor) just to see if the same errors occur. This sounds like a cut-and-paste messing with the white space formatting (which Python is very sensitive about).

mikeysklar
 
Posts: 1995
Joined: Mon Aug 01, 2016 8:10 pm

Re: Simple Simon CircuitPython Version

by stevelup on Mon May 11, 2020 4:20 pm

Downloaded the python code directly from the Adafruit website. Renamed it code.py and copied the file to the CIRCUITPY directory. Same result, i.e. program quits after first button press.
The serial monitor reports this error (there is nothing connected to the Playground Express except the USB cable):
Code: Select all | TOGGLE FULL SIZE

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Traceback (most recent call last):
  File "code.py", line 174, in <module>
  File "code.py", line 107, in get_button_press
  File "code.py", line 97, in cap_map
  File "adafruit_circuitplayground/circuit_playground_base.py", line 348, in touch_A4
  File "adafruit_circuitplayground/circuit_playground_base.py", line 267, in _touch
ValueError: A4 in use



stevelup
 
Posts: 5
Joined: Wed Sep 27, 2017 4:16 pm

Re: Simple Simon CircuitPython Version

by mikeysklar on Tue May 12, 2020 1:19 pm

Thank you for the example errors. It looks like the Simon program is indeed need of updates to be CircuitPython compatible with 5.x

If you wanted to try running CircuitPython 4.1.2 (our last 4.x release) just to confirm that this is the issue we can put in a request to get engineering to update the simon program to 5.x.

https://adafruit-circuit-python.s3.amaz ... -4.1.2.uf2

mikeysklar
 
Posts: 1995
Joined: Mon Aug 01, 2016 8:10 pm

Please be positive and constructive with your questions and comments.