Notifications
Clear all

Dancing Tinkerbell for a pirate magician

82 Posts
6 Users
9 Likes
2,653 Views
(@eliza)
Member
Joined: 2 years ago
Posts: 81
Topic starter  

Update, 2:56 PM Oct 21, 2022   Zander had it right. Thanks Zander. I can't find his post to reply. The Nano was 3 volts and the Mega is 5. I used the identical software and wiring with an Uno and it worked!!! Hooray. This whole thread is resolved. I can push a button at a Nano and see a LED light up on the receiver (temporarily an Uno, until I can get 5 volts out of a Nano) and then send a byte to the Mega on the same pin that formerly was a button, and that pulse generates a hardware interrupt on the Mega which I can see in the serial output.

Summary. This was a difficult problem for me. When I first got my Tinkerbell dancing I had to add the button pushes. I used the EzButton library which was indeed easy. But, the Tinkerbell dance took up all of the main loop. I watched Bill's video about interrupts and used a "pin change interrupt" That eliminated the EzButtons entirely and the button press became no more than:

void ISR1() {
tink.setState(displayCard);
}

This worked perfectly and I simply checked in the middle of my long TinkDancing routine for state change and if I saw a state change I broke out of a loop.

Next we wanted to create the same behavior through remote control. I got the radio communication working and then added it to the original program. Suddenly the working program broke. That's when I started the forum thread.

It was extremely difficult to get people to understand what the problem I was trying to solve was, and I received a lot of spurious feedback. Nevertheless some of this spurious feedback created food for thought which helped get down the debugging trail. Eventually I tracked the problem down to "FastLED breaks timer interrupt code."

This was my original question. Why would working code break when I changed buttons to radio input? The problem wasn't the changing of the buttons to radio, the problem was that the radio code conflicted with FastLED where as the previous hardware interrupt code did not.

Someone made a suggestion at one point about using a "separate processor" which at the time seemed like, "try holding your tongue on the left side of your mouth" but later that comment was the path to success. I went about adding a 3rd arduino that wouldn't have the timer conflict, and indeed it was the way to go.

Once again, I got to a dead end and it was difficult to convey the problem to the participants.

Finally it turned out that my solution was correct, my assumptions were correct, but the voltages didn't agree.

Thanks to Zander for realizing this (obvious to him) fact.

Thanks to everyone for all the feedback, good and bad, because it all eventually coalesced into success. See you next time.

Steve

 


   
DaveE reacted
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2533
 

@eliza 

Glad you finally got it sorted out.

Attaboy @zander 🙂

Anything seems possible when you don't know what you're talking about.


   
DaveE reacted
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6989
 

@will Aw shucks

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
DaveE reacted
ReplyQuote
(@eliza)
Member
Joined: 2 years ago
Posts: 81
Topic starter  

@zander Ok, to reply to Zander I had to look for Ron. I looked and looked for the voltage post (looking for Zander in the name box) So thanks, I got it working now.


   
Ron reacted
ReplyQuote
(@eliza)
Member
Joined: 2 years ago
Posts: 81
Topic starter  

Update on Dancing Tinkerbell. Everything is finally working. First I got the nano to broadcast to the uno, which sent signals on simple wires to the mega to create hardware interrupts. The mega changed states and revealed 4 different patterns on the LED grid.

When I first got it all working I installed the broadcaster into Captain Hook's hook and the receiver into the lantern and everything immediately broke. I took everything apart several times and tested with various hardware configurations and finally got everything working again. Sometimes in the testing I would see that the radio signals were coming through, then they would stop when I didn't touch a thing. Sometimes I would take the USB out of an arduino and switch to a battery and everything would break again. Sometimes I was knocking wires out of their pin holes and didn't notice. Other times there seemed no explanation. Sometimes I would get 8 transmissions in a row and then drop a packet. My conclusion is that these radios are cheap little unreliable boys.

I changed arduino units, changed radios, etc. until I finally got it all going. Then I put the transmitter back into the Hook and it failed again.

Then it occurred to me that perhaps the plastic cuff of the hook was shielding the signal. I ended up putting both antennas outside of their containers and the mystery failure went away. Perhaps the original reason it failed days ago was this shielding problem?

Attaching a couple of photos. ... Check that. I tried to upload 3 separate photos and I only see 1. Final product is uno and mega stuck back to back with foam tape. Nano with transmitter separate. Mega/Uno fit into a lantern base and the Nano fits into a costume pirate hook. Antennas are wrapped unobtrusively around the exteriors of their containers.

.

IMG 0838

   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6989
 

@eliza I think your conclusion is correct. It wouldn't take much to block those HF signals.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@zander

Posted by: @zander

@eliza I think your conclusion is correct. It wouldn't take much to block those HF signals.

IYO, not mine!

I've lost faith in this man, and I will not longer respond to any of his posts!

Cheers


   
ReplyQuote
Page 6 / 6