Arduino - BrendonWatsonLab/Digital-Homecage GitHub Wiki

Arduino Mega 2564 Rev3

image

Technical/Expert Reference:

Internally uses a Atmega2560 chip. With a pin mapping available here: https://www.arduino.cc/en/Hacking/PinMapping2560

Signal Ports:

When a beambreak state changes, or a value is supposed to be written out to one of the solenoids, a signal port is used.

White Wire Pin Atmega2560 Pin Name Atmega2560 Pin Number Meaning I/O
D5 PE3 (OC3A/AIN1) 5 Food 1 Boolean Input
D7 PH4 (OC4B) 16 Food 2 Boolean Input
D3 PE5 (OC3C/INT5) 7 Water 1 Boolean Input
D6 PH3 (OC4A) 15 Water 2 Boolean Input
D8 PH5 (OC4C) 17 Solenoid Power 1 Boolean Input
D11 PB5 (OC1A/PCINT5) 24 Solenoid Power 2 Boolean Input

Relayed Current State Ports:

Event Type Output Signal Arduino Output Pin Atmega2560 Pin Name Atmega2560 Pin Number LJ 15 Add-On Port #
Beambreak Water 1 D22 PA0 (AD0) 78 EIO0
Beambreak Water 2 D24 PA2 (AD2) 76 EIO1
Beambreak Food 1 D26 PA4 (AD4) 74 EIO2
Beambreak Food 2 D28 PA6 (AD6) 72 EIO3
Dispense Water 1 D23 PA1 (AD1) 77 EIO4
Dispense Water 2 D25 PA3 (AD3) 75 EIO5
Dispense Food 1 D27 PA5 (AD5) 73 EIO6
Dispense Food 2 D29 PA7 (AD7) 71 EIO7

Find the port and bit for Arduino pin 22

By looking at the pinout map above, you will find "PA0" next to pin 22.

Arduino pin 22 is connected to ATMega2560 pin PA0 on the Arduino circuit board. Port A and bit 0.

bit 0 in DDRA controls the direction (input/output)

bit 0 in PORTA controls the output (high/low)

You don't need to care about MCUCR, unless you want to disable pull-up on all pins.

Notes: