Hi everybody,
I need to use pin D4 as an analog input, indicated in the datasheet as AN019, but I don't know how to configure it.
Any suggestion ?
Thanks in advance
Your R4 Minima has the same six analog pins as my UNO, A0-A5.
D4 is a digital pin.
Try this.
#include <analog.h> // for analogRead(bsp_io_port_pin_t)
bsp_io_port_pin_t D4A = digitalPinToBspPin(4);
void setup()
{
Serial.begin(115200);
}
void loop()
{
int val = analogRead(D4A);
Serial.println(val);
delay(100);
}
1 Like
did not works, sorry.
anyway thanks for the answ; any other suggestion ?
C:\Users\ricni\Documents\Arduino\oscpocket\code_synth_R4_workcopy\code_synth_R4_workcopy.ino: In function 'void updateControl()':
C:\Users\ricni\Documents\Arduino\oscpocket\code_synth_R4_workcopy\code_synth_R4_workcopy.ino:1284:30: error: 'D4A' was not declared in this scope
int aPot5 = analogRead(D4A);
^~~
C:\Users\ricni\Documents\Arduino\oscpocket\code_synth_R4_workcopy\code_synth_R4_workcopy.ino:1284:30: note: suggested alternative: 'D4'
int aPot5 = analogRead(D4A);
^~~
D4
exit status 1
Compilation error: 'D4A' was not declared in this scope
Solved, was my mistake.
thank you everybody ! ! !
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.