How to use PORTD,PORTB in Arduino ADK Mega

Hello everybody

// Example 43.1
// tronixstuff.wordpress.com/tutorials > chapter 43
// John Boxall - October 2011
// Digital 0~7 set to outputs, then on/off using port manipulation
//http://tronixstuff.wordpress.com/2011/10/22/tutorial-arduino-port-manipulation/
void setup()
{
  DDRD = B11111111; // set PORTD (digital 7~0) to outputs
}

void loop()
{
  PORTD = B11110000; // digital 4~7 HIGH, digital 3~0 LOW
  delay(1000);
  PORTD = B00001111; // digital 4~7 LOW, digital 3~0 HIGH
  delay(1000);
}

This code run good with Arduino ATMega32 ,but can not run with Arduino ADK Mega I don't know why ? Can you help me ? Thanks.

Hello John,

Have you found a solution? I have a similar situation: For an Arduino UNO project I'm using the PIND variable. In the UNO PORTD maps to Arduino digital pins 0 to 7. PIND is a variable for the Port D Input Pins Register - read only. I need the same information for the Mega ADK board - what is the equivalent variable for the digital input pin register 0 - 7?

thanks,

andrew

aluxner: Hello John,

Have you found a solution? I have a similar situation: For an Arduino UNO project I'm using the PIND variable. In the UNO PORTD maps to Arduino digital pins 0 to 7. PIND is a variable for the Port D Input Pins Register - read only. I need the same information for the Mega ADK board - what is the equivalent variable for the digital input pin register 0 - 7?

thanks,

andrew

https://spreadsheets.google.com/pub?key=rtHw_R6eVL140KS9_G8GPkA&gid=0

Hello, I have an Arduino ADK board. I'm trying to use a built-in variable to monitor the digital input pins. For example, on my Arduino UNO PORTD maps to Arduino digital pins 0 to 7 PIND - The Port D Input Pins Register - read only

With the UNO I can use the PIND variable successfully to monitor activity on the pins 0-7. However, this is not working with the ADK board. Although the "PIND" variable is defined I don't know what it maps to and I cannot find the info. For the UNO, there is this web page: http://www.arduino.cc/en/Reference/PortManipulation

However, the page doesn't include the ADK's ATmega2560. How can I find the correct variable to use (if there even is one)? Thanks, andrew

Please do not cross-post. This wastes time and resources as people attempt to answer your question on multiple threads.

In any case, this is not an installation and troubleshooting issue.

Threads merged.

  • Moderator

Was this ever solved? I have the same problem and I can not find a solution.

Mega ADK has many port ..PJ, PH. Search the pin map layout.