I have an Arduino nano and I am trying to use FIRMATA.
I'm digital data examples have this code
if (port < TOTAL_PORTS && value != previousPORT[port]) {
for (i = 0; i < 8; i++) {
currentPinValue = (byte) value & (1 << i);
previousPinValue = previousPORT[port] & (1 << i);
if (currentPinValue != previousPinValue) {
digitalWrite(i + (port * 8), currentPinValue);
}
``|
I want to know how is handled the digitalWrite and why the port is multiplied by 8. Is it the memory address? Is it the same for nano?
In the same code have this too
``|
for (i = 0; i < TOTAL_PORTS; i++) {
outputPort(i, readPort(i, 0xff));
I need to know what is the hexa 0xff? Is it a memory address? Is it the same for nano?
Many thanks in advance.