Products purchased from Adafruit:
- - Gemma M0
- 20 red sequin leds connected to D2
- 6 IR receivers placed on bodice front - connected D0
- NEC mini IR remote
Project description:
In Coppelia when the she comes alive the red LED sequins sewn on the bodice need to be programmed so that they can remotely be turn on and off, blink slow and fast from someone offstage. Appear as if it's magic. We like the way the LEDs look with the pwm fade code and the cyber flower projects. Ideally have all 20 red sequin LEDs, the Gemma M0 D13 red LED and the dotstar[0] blink in sync.
Requirements:
- Remote power on LEDs (D2, D13 and dotstar[0])
Remote power off LEDs (D2, D13 and dotstar[0]
Remotely select and change LED animations listed below in any order:
- 1: Power on red sequins (D2), Gemma M0 red led (D13) and Gemma M0 dotstar[0]. Set dotstar to red
2: Blink red sequin LEDs (D2), Gemma M0 red led (D13) and Gemma M0 neopixel
3: Speed up and slow down blink speed - How do you control time.sleep with IR Remote to speed up or slow down LED blinking? Or is there another way to program LEDs to blink on and off.
4: Ideal: Is there a way to use/modify the pwm LED sample code that enables the LEDs to fades in and fade out. Refer to the Adafruit LED sequins project: https://learn.adafruit.com/adafruit-led ... ython-code
5: Ideal: Add heartbeat animation from the Cyber Flower project to blink all of the 20 red sequin LEDs and Gemma M0 D13 red LED so the LEDs can turn on and off in sync with the dotstar. https://learn.adafruit.com/cyber-flower ... e/software
6: Power off all LEDs remotely
- 1) I am able to power on and off the sequin LEDs connected to D2, Gemma M0 D13 LED and Gemma M0 neopixel using an IR Remote.
2) I have modified the sample circuit python codes for requirements 1, 2, 3, 4, & 6 above and have them working separately while directly connected to my laptop.
3) I can power all LEDs on and off using the All_on_off_IR_remote.py. I added placeholders for the NEC IR remote buttons for planned animations.
4) I am able to run the simple blink code from the remote. However, once it starts the Gemma M0 no longer responds to IR Remote input.
5) I have not been able to find any samples or documentation on how to control fade in & out on the blinking LEDs from an IR Remote. It works on it's own. fade_heart_d13_solid_red_neopixel.py. Need help with how to call animation from IR Remote.
6) I have not been able to add the animation to turn the D2, D13 LEDs on while the dotstar blinks with the cyber flower heartbeat. It works as a standalone, but I need help with how to add it to the code.py file so it can be selected with the IR remote.
Problems/Questions:
1) When adding animation code for each IR Remote button defined, how do I write the code so that the each animation will run just until a new pulse/IR receiver input is detected and decoded by the IR receivers and Gemma M0?
I do not know how long the LEDs will need to be in a specific animation. So it's important that anytime a button is pushed on the IR remote the animation needs to change on the bodice. Do I add an interrupt or something? Is there another way to code blinking and fading and heartbeats besides using a While True loop that would be better? Something that ensures the Gemma M0 is listening for IR Remote input. I think this is the problem I have with the simple loop that turns the LEDs on and off with a time.sleep delay in between states. Once the animation is selected the Gemma M0 no longer responds to input from the IR Controller.
2) Is there documentation on how to write the code for multiple LED animations (on, blink slow, blink fast, fade, heartbeat, off) controlled by an IR Remote? Or sample code from a single color LED light strings that would work with Gemma M0 I could reference?
3) Is it possible to group the sequin LEDs on D2 with the red LED D13? Can I group them with the Gemma M0 dotstar[0] so that they stay in sync when fading in and out?
4) How do I add more complicated subprograms like the pwm (Adafruit LED sequin sample code) or the cyber flower heartbeat as animation options with the remote? I have them running as modified stand-alone py files but I have no idea how to code it into the single circuit python file to work from IR Remote control. I work really well with samples. I have also uploaded the modified animation py files that work.
Additional information:
Due to footprint on bodice the Gemma M0 is the best size, however I did purchase Flora and Playground express boards too?
I have been trying to get this to work using Circuit python because it was on the board and I could not find the IR Remote libraries for Gemma M0 in Makecode. Can I do this easier in Make Code? or Arduino IDE? Does anyone have sample code or could help me?
Files attached:
- what I'm using to blink LEDs and dotstar - is there a better way? How do I add this so IR Remote control?