arduino / arduino/ArduinoCore-mbed
Cannot use A0 or A1 as digital inputs in M4 processor on Opta Lite
- Dominant language
- C
- Stars
- 411
- Forks
- 225
- PR merge metrics
- No merged PRs in 30d
Description
I have an Opta Lite and am trying to use the digital inputs from the M4 processor, but have found a problem reading A0 (PA0_C) and A1 (PC2_C ). As an example, the code below to debounce the inputs and switch the relays works fine on the M7, but on the M4 it only works with inputs A2 to A7, A0 & A1 do nothing. Note that the only code on the other processor during the test is an RPC.begin();
Any assistance would be greatly appreciated.
```c
#include
const byte switches = 4;
int switchinput[] = {A0, A1, A2, A3};
bool currentstatus[] = {LOW, LOW, LOW, LOW};
bool laststatus[] = {LOW, LOW, LOW, LOW};
unsigned long lastbouncetime[] = {0, 0, 0, 0};
int relayoutput[] = {RELAY1, RELAY2, RELAY3, RELAY4};
int statusled[] = {LED_D0, LED_D1, LED_D2, LED_D3};
bool outputstatus[] = {LOW, LOW, LOW, LOW};
int debouncedelay = 50;
unsigned long currentlooptime;
void setup() {
RPC.begin();
// initialise inputs & outputs
for(byte loop=0; loop= lastbouncetime[switchnum] && currentstatus[switchnum] != outputstatus[switchnum])
{
outputstatus[switchnum] = currentstatus[switchnum];
digitalWrite(relayoutput[switchnum], outputstatus[switchnum]);
digitalWrite(statusled[switchnum], outputstatus[switchnum]);
}
}
}
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the sketch on an Opta Lite with the M4 processor and compare digitalRead behavior for A0 and A1 against A2 through A7. Inspect the core's pin definitions and mappings for PA0_C and PC2_C; done means A0 and A1 can be used as digital inputs and switch the relays like the other inputs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100