Silly Nano !

Dom wants to use A6 & A7 on the Nano

I'm about to add the 2 pins in the Arduino service pin definition for the Nano .. but what are the "real" addresses of these pins ?

They are not listed on any documentation .. I found this excellent description regarding these mysterious and silly pins on the Arduino forums..

Sigh....

Analog pins A0~A5 are normal pins. You can refer to them as pins 14-19 as well, and they can be used normally as digital pins. 

Analog pins A6 and A7 are weird. They can *only* be used for analogRead() - there aren't any registers to write to for them like there are for other pins. I get the impression they were an afterthought (maybe the DIP package was released first, then they're like "hey we have some extra pins on TQFP32, let's connect them to the unused channels on the ADC mux")...

 

Heh ... I like the "Sigh...." :)

Anyhow, if someone can tell me the "real" addresses of these pins I can add 2 analog pins to the Nano. I suspect it would be hacking through the Arduino MACRO definitions in the boards.txt/Wire.h etc...


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
dom14's picture

Thank you Grog. If i check

Thank you Grog.

If i check arduino documentation, i found this https://www.arduino.cc/en/Reference/AnalogRead

So, analogRead(pin) with pin 0 to 7 for nano. (0 to 5 for uno).

Dom

GroG's picture

did it work ?

did it work ?

dom14's picture

Hi, yes it is works. I add

Hi, yes it is works.

I add this code for test in mrlcomm.ino

unsigned long pm = 0;
 
void loop() 
{
  // get a command and process it from
  // the serial port (if available.)
  // wdt_disable();
  if (mrlComm.readMsg()) 
  {
    mrlComm.processCommand();
  }
  // update devices 
  mrlComm.updateDevices();
  // send back load time and memory
  // driven by getBoardInfo now !!!
  // mrlComm.publishBoardStatus();
  #if defined(ESP8266)
    webSocket.loop();
  #endif
 
  // ADD Test for analogRead with A6 and A7
  unsigned long cm = millis();
  unsigned int val1;
  unsigned int val2;
 
  if (cm - pm >= 1000) 
  {
    pm = cm;
 
    // every 1s
 
    val1 = analogRead(6);
    val2 = analogRead(7);
 
    sndBuff[0] = 41;
    sndBuff[1] = (val1 >> 8) & 0x00FF;
    sndBuff[2] = val1 & 0x00FF;
    sndBuff[3] = (val2 >> 8) & 0x00FF;
    sndBuff[4] = val2 & 0x00FF;
    mrlComm.sendCustomMsg(sndBuff, 5);
  } // END ADD
 
} // end of big loop
 
 
After, in python i do this:
 
manipulatorLeft = Runtime.createAndStart("manipulatorLeft","Arduino")
manipulatorLeft.setBoardNano()
manipulatorLeft.connect("COM7")
manipulatorLeft.publishState()
 
# For test A6 and A7
manipulatorLeft.addListener("publishCustomMsg", python.getName(), "publishCustomTestAnalogData")
 
def publishCustomTestAnalogData(data):
  if data[0] == 41:
    print "Test A6 and A7: ", data[1],data[2],data[3],data[4] 
 
 
And i receive good value.
 
So ok, it is not the solutions, but analogRead(6) and analogRead(7) works very well.
 
Dom.
 
 
 
 
Humanoid's picture

Thanks

I needed that info