I’d like to add whisker bumpers to my Zumo (the Arduino Shield version).
My Uno has hardware interrupts on pins 2 and 3, I believe. I can access Pin 2 on the front expansion area, easy peasy. I can access Pin 3 on the side expansion area. I have jumpered the buzzer into life, which is on Pin 3.
I have a few questions:
Did enabling the buzzer Pin 3 mean I can’t use it for anything else? (I haven’t tried yet because disassembly and soldering a piece of header takes more time than simply asking.) Or does it just mean I won’t be using the buzzer while I’m also using it for an interrupt?
Rather than an external interrupt, I was also considering a timer interrupt (detailed here) to use any ol’ pin for the whiskers, and just check them every millisecond. But I see this part of the code:
OCR0A = 0xAF; TIMSK0 |= _BV(OCIE0A);
and I glaze over. I don’t really understand what’s happening there other than about halfway through the timer (175), it does a thing. In the tutorial, it seems that the ISR is whatever function is just below it? Or is the gibberish above calling the ISR by name? Is that what SIGNAL(TIMER0_COMPA_vect) does? If so, how does TIMER0_COMPA_vect translate from gibberishy code above it?
I’m just getting back into Arduino and robotics, and was always a rank amateur anyway. Thank you in advance for over-explaining any advice.