I have 3 tasks for my Arduino, ADC to read anolog signal, printing work to display all info to OLED and motor.
Wondering how interrup works for R4, cannot find any usefull reference.
Tell us why you think interrupts are necessary, or appropriate.
Really?
Page 4 of https://docs.arduino.cc/resources/pinouts/ABX00080-full-pinout.pdf
You didn't find the above useful? Or you didn't find the above?
you don't say how often they need to be done
wouldn't this work
const byte PinAdc = A0;
const byte PinPwm = 10;
// -----------------------------------------------------------------------------
void loop ()
{
int adc = analogRead (PinAdc);
int pwm = map (adc, 0, 1023, 0, 255);
analogWrite (PinPwm, pwm);
// use timer to update less often to minimize flicker
static unsigned long msec0;
unsigned long msec = millis ();
if (msec - msec0 >= 250) {
msec0 = msec;
char s [90];
sprintf (s, "adc %4d, pwm %4d", adc, pwm);
oledDisp (s);
}
}
// -----------------------------------------------------------------------------
// stub for oled
void
oledDisp (
const char *s )
{
Serial.println (s);
}
// -----------------------------------------------------------------------------
void setup ()
{
Serial.begin (9600);
pinMode (PinPwm, OUTPUT);
}

