Circuit playground express code

Play with it! Please tell us which board you're using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
rasfh
 
Posts: 15
Joined: Mon Aug 28, 2017 5:07 am

Circuit playground express code

Post by rasfh »

Hello

I am a happy owner of a Circuit playground express.
I am a newbie in programming, and I have tried to write a program.
It runs fine, but when I use KeyboardInterrupt (ctrl + c) in putty ssh terminal, I got some strange respond.
I have the lastest firmware file (uf2 version 2.0) and the lastest circuitpython bundle with library.
This can be seen on the pictures.

I hope someone can help me (:
Attachments
code putty.png
code putty.png (66.49 KiB) Viewed 591 times
code circuitplayground express.png
code circuitplayground express.png (89.77 KiB) Viewed 591 times

User avatar
rasfh
 
Posts: 15
Joined: Mon Aug 28, 2017 5:07 am

Re: Circuit playground express code

Post by rasfh »

As an addition.
The code works when the board is connected to a laptop, but not with batterypack.

User avatar
danhalbert
 
Posts: 4652
Joined: Tue Aug 08, 2017 12:37 pm

Re: Circuit playground express code

Post by danhalbert »

Glad you're having fun! The "Traceback" you are seeing when you type control-C is completely expected. You have interrupted the program and it tells you where the interrupt happened.

A simplication of your if statement:

Code: Select all

while True:
    if touch1.value:
        ...
    else:
        ....
You don't explicitly have to compare with True, and if it's not True, then it's going to be False.

There's nothing wrong with your code that would make it not work with a battery pack. I'd suspect an issue with the pack: it may simply need to be charged more.

User avatar
rasfh
 
Posts: 15
Joined: Mon Aug 28, 2017 5:07 am

Re: Circuit playground express code

Post by rasfh »

Thanks for your reply.

It still doesn't work with batterypack, and I have tried changing to new batteries.
I have made a video about the paticular problem, from uploading the firmware to making the program

https://www.youtube.com/watch?v=mfU2VfoMNnw

I hope you can help (:

User avatar
danhalbert
 
Posts: 4652
Joined: Tue Aug 08, 2017 12:37 pm

Re: Circuit playground express code

Post by danhalbert »

Ah, maybe I was wrong about running with the battery pack only. Remove the print() statement and try again with the battery pack. It may be trying to print and hanging because there's nowhere to print to.

User avatar
rasfh
 
Posts: 15
Joined: Mon Aug 28, 2017 5:07 am

Re: Circuit playground express code

Post by rasfh »

Hm, it doesn't do any difference to remove the print statement.
Can it be a problem that it is a while True loop?

To get the program running, it has to be connected to putty (ssh) and set in auto-reload.
If that isn't done, then it won't work. So it has to be connected with putty.
Even if you connect the board to the laptop without connecting to putty, the neopixels just light up red (from the else: statement)
but it's not reacting to touchpad A0.

User avatar
jerryn
 
Posts: 1868
Joined: Sat Sep 14, 2013 9:05 am

Re: Circuit playground express code

Post by jerryn »

Just a guess, but coouldit be that the Touch sensitivity is different for the battery connected case than for the USB connected case. You could try adding a wire to the touchpad or better some conductive surface like copper tape attached to the pad.

User avatar
rasfh
 
Posts: 15
Joined: Mon Aug 28, 2017 5:07 am

Re: Circuit playground express code

Post by rasfh »

I have tried another program, which is a fidget spinner, made by Tony Dicola and Tannewt from adafruit.

https://github.com/adafruit/Adafruit_Ci ... spinner.py

That fidget spinner program works fine with batterypack, so there must be some bug with my own program?? (:

User avatar
jerryn
 
Posts: 1868
Joined: Sat Sep 14, 2013 9:05 am

Re: Circuit playground express code

Post by jerryn »

Not necessarily, the fidget spinner does not use the touchio code. I still wonder if there is a difference. I can test this tonight or tomorrow when I get home with my CPX. (i'm on bus now ;-)

User avatar
rasfh
 
Posts: 15
Joined: Mon Aug 28, 2017 5:07 am

Re: Circuit playground express code

Post by rasfh »

Jerry:
That would be nice (:

That code I use, is the one I posted before. (on the picture).
except the print statement (A0 touched!) which I deleted, because I wanted to connect it to a batterypack.

User avatar
rasfh
 
Posts: 15
Joined: Mon Aug 28, 2017 5:07 am

Re: Circuit playground express code

Post by rasfh »

And I have the lastest uf2 firmware and circuitpython bundle from github, which is updated a couple of days ago.

User avatar
jerryn
 
Posts: 1868
Joined: Sat Sep 14, 2013 9:05 am

Re: Circuit playground express code

Post by jerryn »

I'll try to reproduce your setup and see how mine responds. What battery are you using? If I can reproduce your situation, I can then see if I can create something that works. It probably won't be until tomorrow morning (EDT) though.

User avatar
danhalbert
 
Posts: 4652
Joined: Tue Aug 08, 2017 12:37 pm

Re: Circuit playground express code

Post by danhalbert »

I just tried this with a LiPo battery and it worked, though A0 seemed a little flakier than A1. I also couldn't just touch the edge: I had to touch the whole ring of the hole, sometimes a little firmly.

User avatar
rasfh
 
Posts: 15
Joined: Mon Aug 28, 2017 5:07 am

Re: Circuit playground express code

Post by rasfh »

Jerryn:

I use 3 X AA batteries (:

User avatar
rasfh
 
Posts: 15
Joined: Mon Aug 28, 2017 5:07 am

Re: Circuit playground express code

Post by rasfh »

Danhalbert:

Sounds odd, since I can only get it to work, with a laptop, and then connected to the board by putty (ssh)

Locked
Please be positive and constructive with your questions and comments.

Return to “Circuit Playground Classic, Circuit Playground Express, Circuit Playground Bluefruit”