On my Uno, I set up the HoodLoader2 (link below) so I can program both the ATMega16u2 and the ATmega328P. I can communicate between the two using the serial port. However, I need the serial port to communicate between the Uno and the PC. Can I communicate between the 328 and 16u2 using a common digital pin? All I need to communicate is a simple yes/no state, preferably in both directions. In other words: can I connect a digital pin (say 12) on the Uno to, say, PB1 pin on the 16u2's ICSP header, set pin 12 value to HIGH on the 328P, then read that state on the 16u2 via PB1? And vice versa, via another pair of pins? There's a Q that's close to what I want (link below) and the user there (@jsotola) seems to have the knowledge, but I can't comment under his comment, as I don't have 50 reputation.
1 Answer
You could use from PB1 to PB3 from 16u2 (SCK, MOSI, MISO) wich are exposed to its ICSP. Add a wire from one of them to your atmega328 :)
-
Thanks. What does "PB" stand for? Is this a "normal", digital pin, with HIGH and LOW states? Commented Aug 15, 2018 at 7:05
-
It means port B (PB1 physical pin 15 to PB3 pin 17). Don’t Know how hoddler name the pins :) here you’ll fins the uno schematic arduino.cc/en/uploads/Main/Arduino_Uno_Rev3-schematic.pdf– BoucCommented Aug 15, 2018 at 7:09
-
This is the original ATmega pin naming and stands for
Port B, pin 1
. all the pins are separated into banks (ports) of 8 pins each. For pin functions, refer to the relevant datasheet: ww1.microchip.com/downloads/en/DeviceDoc/…– mysteryCommented Aug 15, 2018 at 8:54 -
It seems that SCK MOSI and MISO correspond to D1, D2 and D3 (github.com/NicoHood/HoodLoader2/wiki/…) on the 16u2. And yes they are digital « normal ;) » pins– BoucCommented Aug 15, 2018 at 12:59