0

Simple CPX CRICKIT Servo Problem
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Simple CPX CRICKIT Servo Problem

by pambrose on Tue Nov 27, 2018 9:26 pm

I am experiencing failures with a trivial MakeCode app:
https://www.dropbox.com/s/4zh4pif5gzzlr ... o.png?dl=0

I am using a CPX/Crickit with a J-Deal Micro Servo 9g.

My software versions are:
Adafruit Circuit Playground Express version: 1.2.9
Microsoft MakeCode version: 5.1.5
codal-circuit-playground runtime version: v1.5.6

The failure is expressed by the servo stopping and this LED pattern:
https://www.dropbox.com/s/mbmoge2y9i6b3 ... x.jpg?dl=0

It fails consistently after:
~1 min 42 secs if I wait 1 second between iterations
~54 secs if I wait 500ms between iterations
~21 secs if I wait 200ms between iterations
~11 secs if I wait 100ms between iterations

If I use CircuitPython to do the same servo movements, it works fine.

Please advise.

Thanks,
Paul

pambrose
 
Posts: 18
Joined: Thu Sep 29, 2016 7:09 pm

Re: Simple CPX CRICKIT Servo Problem

by adafruit2 on Tue Dec 04, 2018 2:33 pm

hiya - we've done a ton of CPX servo stuff, so it should work - if you have other stuff in the makecode script like another loop that blinks leds or something, does that work? like does just the servo part stop working, or is the whole program halted?

we moved this to the MakeCode forum, thats the best place to post MakeCode Quesitons :)

adafruit2
Site Admin
 
Posts: 17772
Joined: Fri Mar 11, 2005 7:36 pm

Re: Simple CPX CRICKIT Servo Problem

by pambrose on Wed Dec 05, 2018 9:16 pm

Adding a command to enable an LED has not effect. However, if I add a "show animation for 100ms" command between servo movements, that seems to prevent the crashing. This is interesting, but it does not fix the fundamental problem that is apparent in the most trivial servo usage case.

Please run the Makecode snipet that I mentioned in my original post with a servo and see the crashing behavior for yourself. There is clearly a timing-related issue that needs to be addressed in order for students to have luck with the Makecode/CPX/Crickit combination.

Yes, the whole program is halted and the LED pattern shown in the image linked in my original note is displayed.

Thanks,
Paul

pambrose
 
Posts: 18
Joined: Thu Sep 29, 2016 7:09 pm

Re: Simple CPX CRICKIT Servo Problem

by johnpark on Thu Dec 06, 2018 1:31 pm

I think you may be pushing your servo beyond its limits. 180 is the theoretical range, but often they don't go quite that far. Try reducing your angle value from 30 to 10 and see how it goes. Mike B.'s guide is a good place to start if you haven't tried it already: https://learn.adafruit.com/make-it-move ... -servo-now

johnpark
 
Posts: 287
Joined: Wed Mar 25, 2009 2:15 pm

Re: Simple CPX CRICKIT Servo Problem

by pambrose on Thu Dec 06, 2018 1:51 pm

If I narrow the the range of angles, the same problem happens. Also, the 0 to 180 angles work fine in CircuitPython.

I lie prostrate before you, asking you to recreate this simple setup on your end and see the failure for yourself. It is a significant problem that needs to be addressed.

Thanks,
Paul

pambrose
 
Posts: 18
Joined: Thu Sep 29, 2016 7:09 pm

Re: Simple CPX CRICKIT Servo Problem

by pambrose on Thu Dec 06, 2018 2:02 pm

Better yet, try the code snipet shown here: https://learn.adafruit.com/assets/56294

It fails for me with two different servos.

Thanks,
Paul

pambrose
 
Posts: 18
Joined: Thu Sep 29, 2016 7:09 pm

Re: Simple CPX CRICKIT Servo Problem

by adafruit2 on Thu Dec 06, 2018 4:55 pm

ok just tried it and yeah it does that weird neopixel thing. which is super odd because that's not anywhere in our code. we'll have to ask the makecode folks what it could be, its definitely new - all those examples used to run.
we put an issue here https://github.com/Microsoft/pxt-adafruit/issues/924

pamb, do you know when this started happening? it may have been something in a recent release

adafruit2
Site Admin
 
Posts: 17772
Joined: Fri Mar 11, 2005 7:36 pm

Re: Simple CPX CRICKIT Servo Problem

by pambrose on Thu Dec 06, 2018 5:26 pm

Unfortunately, I have been working with the MakeCode/CPX/Crickit for only a few weeks, so I am afraid I have never seen it work properly.

CPX/Crickit is working like a champ with CircuitPython, but our kids need the MakeCode support.

Thanks,
Paul

pambrose
 
Posts: 18
Joined: Thu Sep 29, 2016 7:09 pm

Re: Simple CPX CRICKIT Servo Problem

by adafruit2 on Thu Dec 06, 2018 5:30 pm

ok its for sure a new thing, ive pinged makecode dev team, they're doing that huge refactor to fix the i2c support, and may have introduced another bug in the meantime. yay software!

adafruit2
Site Admin
 
Posts: 17772
Joined: Fri Mar 11, 2005 7:36 pm

Re: Simple CPX CRICKIT Servo Problem

by johnpark on Thu Dec 06, 2018 6:02 pm

Even weirder, this works perfectly fine on my CPX and Crickit using that code example.
Here it is in action: https://youtu.be/OI131JueKc0

johnpark
 
Posts: 287
Joined: Wed Mar 25, 2009 2:15 pm

Re: Simple CPX CRICKIT Servo Problem

by adafruit2 on Thu Dec 06, 2018 6:09 pm

woah for real? what version does the makecode site say you're running? can you toss your UF2 here?

adafruit2
Site Admin
 
Posts: 17772
Joined: Fri Mar 11, 2005 7:36 pm

Re: Simple CPX CRICKIT Servo Problem

by johnpark on Thu Dec 06, 2018 6:17 pm

Adafruit Circuit Playground Express version: 1.2.9

Microsoft MakeCode version: 5.1.5

codal-circuit-playground runtime version: v1.5.6

Hang on, I'll add the .uf2

johnpark
 
Posts: 287
Joined: Wed Mar 25, 2009 2:15 pm

Re: Simple CPX CRICKIT Servo Problem

by johnpark on Thu Dec 06, 2018 6:18 pm

circuitplayground-servo.uf2
(248.5 KiB) Downloaded 6 times

johnpark
 
Posts: 287
Joined: Wed Mar 25, 2009 2:15 pm

Re: Simple CPX CRICKIT Servo Problem

by adafruit2 on Thu Dec 06, 2018 6:42 pm

yeah that works fine for me too.
try this one - its what i generated

Adafruit Circuit Playground Express version: 1.2.9

Microsoft MakeCode version: 5.1.5

codal-circuit-playground runtime version: v1.5.6
Attachments
circuitplayground-one-servo-stepped(1).uf2
(280.5 KiB) Downloaded 4 times

adafruit2
Site Admin
 
Posts: 17772
Joined: Fri Mar 11, 2005 7:36 pm

Re: Simple CPX CRICKIT Servo Problem

by johnpark on Thu Dec 06, 2018 7:10 pm

No, that does the bad thing. Blinking red D13, NeoPixels blue and red.

johnpark
 
Posts: 287
Joined: Wed Mar 25, 2009 2:15 pm

Please be positive and constructive with your questions and comments.