Hardware – How are the various pins of the Arduino Mega 2560 used while Mathematica recognizes it as a Uno board?

You can not identify the other pins with the current Mathematica (currently 11.3). Currently, Mathematica has not been upgraded to the version of FIRMATA that limits the reading pins available in UNO. I have addressed this topic several times. Everything indicates that Wolfram has focused on integrating Raspberry Pi.

If you want to read pins other than A5 and D13, you must use the serial function. Here's an example of reading analog pins. Note that you must manually assign the port ID. My example here is for a Windows platform using COM1-COMx

                dev = DeviceOpen["Serial", {"COM9", "BaudRate" -> 115200}]
(* This is for the port format of the Windows platform.) Replace COMx with x
Port number and budget as in the sketch *)

Data = {};

volt = {};

task = RunScheduledTask[
  If[DeviceExecute[dev, "SerialReadyQ"],
module[{csv, raw},
    csv = FromCharacterCode[DeviceReadBuffer[dev]];
raw = flattening[Cases[ImportString[csv, "CSV"], {_Really}]];
volt = ToExpression[raw, TraditionalForm];
data = Join[data, volt];
]To press[Dynamic[volt]]Dynamic[ListLinePlot[data]](* ARDUINO SCKETCH
// Setup the Arduino with Mathematica
void setup () {Serial.begin (115200);}

Empty loop () {
// A value of 1023 = 5V, a value of 0 = 0V
// Arduino Mega and other boards can use an analog read pin.
int value = analogRead (A14);
Float voltage = value * (5.0 / 1023.0);
Serial.println (voltage);
Delay (100);}