CPE+Crickit - motor rotation

This is a special forum devoted to educators using Adafruit and Arduino products for teaching.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
rpeteranderl
 
Posts: 7
Joined: Thu May 28, 2015 1:44 pm

CPE+Crickit - motor rotation

Post by rpeteranderl »

My students are building a robot with CPE as the brains and Crickit as a driver for two hobby motors at 5V. The programming is done in Makecode with blocks. The task is to have the robot move forward, and then under certain conditions spin in place to change directions. They use the Neopixels to monitor the state of the program.
A group is using the "cricket tank motors (-50%) (50%) command, but the motors keep spinning in the same (+) direction. LEDs indicate that the robot is in the spin state, and in other steps of the program the motors did run backwards as expected. Any ideas what might be going on? -- Thanks for any help

User avatar
Franklin97355
 
Posts: 24401
Joined: Mon Apr 21, 2008 2:33 pm

Re: CPE+Crickit - motor rotation

Post by Franklin97355 »

Not using Makecode I don't know if it is possible to post your code but it would help if you can.

User avatar
adafruit_support_bill
 
Posts: 89646
Joined: Sat Feb 07, 2009 10:11 am

Re: CPE+Crickit - motor rotation

Post by adafruit_support_bill »

Do you have one of your motors set to 'invert' the rotation direction?

https://learn.adafruit.com/adafruit-cri ... ed-2989460
Image

User avatar
rpeteranderl
 
Posts: 7
Joined: Thu May 28, 2015 1:44 pm

Re: CPE+Crickit - motor rotation

Post by rpeteranderl »

adafruit_support_bill wrote: Tue May 14, 2024 5:18 am Do you have one of your motors set to 'invert' the rotation direction?

https://learn.adafruit.com/adafruit-cri ... ed-2989460
Image
Thanks for the suggestion. No, we haven't tried that yet. I thought that block was mainly to make up for hardware confusion when the wiring went wrong. I'll pass it on, and we'll see what comes of it

User avatar
rpeteranderl
 
Posts: 7
Joined: Thu May 28, 2015 1:44 pm

Re: CPE+Crickit - motor rotation

Post by rpeteranderl »

Franklin97355 wrote: Mon May 13, 2024 5:33 pm Not using Makecode I don't know if it is possible to post your code but it would help if you can.
Here's the screenshot with the code. The bit in question is after the LEDs at 2 and 7 are turned red and green

Image
Attachments
screenshot of the code in question
screenshot of the code in question
robotcode.png (101.63 KiB) Viewed 613 times

User avatar
adafruit_support_bill
 
Posts: 89646
Joined: Sat Feb 07, 2009 10:11 am

Re: CPE+Crickit - motor rotation

Post by adafruit_support_bill »

What do the motors do when both lights are green?

User avatar
rpeteranderl
 
Posts: 7
Joined: Thu May 28, 2015 1:44 pm

Re: CPE+Crickit - motor rotation

Post by rpeteranderl »

screenshot of make code blocks
screenshot of make code blocks
robotcode.png (101.63 KiB) Viewed 602 times
screenshot of make code blocks
screenshot of make code blocks
robotcode.png (101.63 KiB) Viewed 602 times
screenshot of make code blocks
screenshot of make code blocks
robotcode.png (101.63 KiB) Viewed 602 times
screenshot of make code blocks
screenshot of make code blocks
robotcode.png (101.63 KiB) Viewed 602 times
adafruit_support_bill wrote: Tue May 14, 2024 5:18 am Do you have one of your motors set to 'invert' the rotation direction?

https://learn.adafruit.com/adafruit-cri ... ed-2989460
Image
Sorry for the follow-up, but here is a screen shot of the program from my student. (-100, -100) and (100, 100) do what is expected, but the (-100,100) keeps going straight with both wheels going forward instead of turning. Do you have any idea what went wrong? We are going to try Motor 1 (-100%), Motor 2 (100%) in separate commands tomorrow, as well as Motor 1 (0%), Motor 2 (100%). Do you have any other suggestions?

User avatar
adafruit_support_bill
 
Posts: 89646
Joined: Sat Feb 07, 2009 10:11 am

Re: CPE+Crickit - motor rotation

Post by adafruit_support_bill »

What do the motors do when both lights are green?

User avatar
rpeteranderl
 
Posts: 7
Joined: Thu May 28, 2015 1:44 pm

Re: CPE+Crickit - motor rotation

Post by rpeteranderl »

adafruit_support_bill wrote: Wed May 15, 2024 8:06 am What do the motors do when both lights are green?
They move both in the same direction, as intended

User avatar
adafruit_support_bill
 
Posts: 89646
Joined: Sat Feb 07, 2009 10:11 am

Re: CPE+Crickit - motor rotation

Post by adafruit_support_bill »

I'll have one of our MakeCode experts take a look.

User avatar
rpeteranderl
 
Posts: 7
Joined: Thu May 28, 2015 1:44 pm

Re: CPE+Crickit - motor rotation

Post by rpeteranderl »

adafruit_support_bill wrote: Wed May 15, 2024 1:25 pm I'll have one of our MakeCode experts take a look.
Thanks so much! In my next class with that team today I will have a look at the Java version of their program to see if anything sticks out to me (although I know next to nothing about Java...)

User avatar
adafruit2
 
Posts: 22792
Joined: Fri Mar 11, 2005 7:36 pm

Re: CPE+Crickit - motor rotation

Post by adafruit2 »

ok lets try just a simple app with a single block so we can be sure that we're testing just one thing. in case the 100-ness is causing an issue, can you try just setting the motors to +50/-50?

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

Return to “For Educators”