Folks,
I have been working with CircuitPython on a CPX/CRICKIT board and have the code almost worked out but need a little help.
I have a 4 channel radio control receiver interfaced with the CPX/CRICKIT IO pins.
Attached is a snippet of the code I'm using.
When I push Button A on the keyfob remote, the CPX/Crickit recognizes this and starts playing Alex.wav.
At the same time, the eyes more back and forth via Servo1 and are supposed to stop on the center.
After Alex.wav, Servo2 activates for 5 seconds and retracts.
My problem is Servo1 does not appear to go to the center (90°) after Alex.wav plays.
So the eyes look like they're looking to the right after the sound stops.
When you hit the next Button, the eyes center again but get stuck off center at the end.
Also, is there a way to define this function and if so, how?
I will probably use this same function for all 4 buttons on the keyfob remote.
I'm not that great at coding yet and muddled around with it with no luck.
Once I get the code working, I might post a YouTube video showing it all in action.
Thank you in advance for reviewing this and responding.
This forum is a great compilation of people more talented than I.
May the FORCE be with you and have a magical day!
MagicBill
CPX/CRICKIT CODING HELP NEEDED
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- htmagic
- Posts: 89
- Joined: Tue Dec 03, 2013 12:18 am
CPX/CRICKIT CODING HELP NEEDED
- Attachments
-
- mod_code2.txt
- (3.31 KiB) Downloaded 10 times
- dastels
- Posts: 15652
- Joined: Tue Oct 20, 2015 3:22 pm
Re: CPX/CRICKIT CODING HELP NEEDED
You break out of the loop that moves the servo back & forth before recentering it. Maybe just move
to after
Dave
Code: Select all
if (count == 2):
break
Code: Select all
eye_servo.angle = 90
time.sleep(1)
Please be positive and constructive with your questions and comments.