in analogRead, ioPin is not initialized to a value. in the board switch statement:
case BoardPinsClass::BOARD_TYPE::MBM_BARE:
case BoardPinsClass::BOARD_TYPE::PI2_BARE:
// Translate the pin number to a fake pin number.
if (pin < A0)
{
ioPin = A0 + pin;
}
break;
default:
ThrowError(hr, "Unrecognized board type: 0x%08x", board);
}
// Perform the read.
hr = g_adc.readValue(ioPin, value, bits);
if (FAILED(hr))
{
ThrowError(hr, "Error performing analogRead on pin: %d, Error: 0x%08x", pin, hr);
}
this means if I accidentally pass a bad pin, there is no trap and it falls through and used without being initialized.
in analogRead, ioPin is not initialized to a value. in the board switch statement: case BoardPinsClass::BOARD_TYPE::MBM_BARE: case BoardPinsClass::BOARD_TYPE::PI2_BARE: // Translate the pin number to a fake pin number. if (pin < A0) { ioPin = A0 + pin; } break; default: ThrowError(hr, "Unrecognized board type: 0x%08x", board); }
this means if I accidentally pass a bad pin, there is no trap and it falls through and used without being initialized.