DAVID | Posted: 28 Aug 2018, 02:56 AM |
---|---|
I love mcus Member Posts: 237 Joined: 10-September 17 |
hi i recently made a self playing xylophone based on the arduino mega https://youtu.be/randDlbnDiM and it turn out pretty well, the problem is that it hits a note when there is a note on command and then waits 20ms before turning off the solenoid and for the delay i use a simple delay function which stop the mcu so when i play notes at the same time there is a delay between notes. So can somebody help me Last edit by DAVID at 28 Aug 2018, 11:16 PM ------------- |
[top] | |
mit | Posted: 28 Aug 2018, 09:29 AM |
yeah whatever Admin Posts: 566 Joined: 4-May 16 |
Hi, that's pretty cool. There are several ways you can solve the waiting problem. One way is to use interrupts for the timing. Configure an interrupt to run from one of the timers, maybe every 1ms. Have an array of counters for the solenoids, and when you turn one of them on, set its counter to 20. In the interrupt routine loop over the counters and if it's more than 0, decrease it, and if it hits zero turn off that solenoid. The copper pipes look cool, but if you can find some steel pipes or steel rods it might sound better. ------------- |
[top] | |
DAVID | Posted: 29 Aug 2018, 12:32 AM |
I love mcus Member Posts: 237 Joined: 10-September 17 |
thanks mit, i use timer5 for reading which of the pins are high and then wait 20ms and turn it off so from this
to this
if (MIDI.read()&&MIDI.getChannel()!=10) // Is there a MIDI message incoming ? Last edit by DAVID at 31 Aug 2018, 06:15 AM ------------- |
[top] | |
DAVID | Posted: 29 Aug 2018, 12:34 AM |
I love mcus Member Posts: 237 Joined: 10-September 17 |
the synth is working fine https://github.com/theawsomeavr/self-playing-xylophone https://youtu.be/P_dYiSwsxfs Last edit by DAVID at 29 Aug 2018, 03:23 AM ------------- |
[top] | |
alesters1 | Posted: 10 Sep 2018, 10:16 PM |
Member Posts: 1 Joined: 10-September 18 |
spam Last edit by mit at 10 Sep 2018, 10:54 PM ------------- |
[top] | |
Sign in to post a reply.