Using unconnected analog pins in RA4M1 with arduino ide

I am trying to use the analog and digital pins of the platform, I was already able to configure and use the digital pins, but I have not been able to make the analog pins work, I have configured the pins in analog mode but at the time of reading I have not found how to do it, Does anyone have an example of how to do it?

I made this example to test the digital and analog pins but only the digital ones work

void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  R_IOPORT_PinCfg(NULL,BSP_IO_PORT_04_PIN_11,IOPORT_CFG_PORT_DIRECTION_OUTPUT | IOPORT_CFG_PMOS_ENABLE);
  R_IOPORT_PinCfg(NULL,BSP_IO_PORT_00_PIN_04,IOPORT_CFG_PORT_DIRECTION_INPUT | IOPORT_CFG_ANALOG_ENABLE);
}

// the loop function runs over and over again forever
void loop() {
  R_IOPORT_PinWrite(NULL, BSP_IO_PORT_04_PIN_11, BSP_IO_LEVEL_HIGH);
  delay(3000);                      // wait for a second
  R_IOPORT_PinWrite(NULL, BSP_IO_PORT_04_PIN_11, BSP_IO_LEVEL_LOW);
  delay(1000);                      // wait for a second
  // R_IOPORT_PinRead(NULL, BSP_IO_PORT_00_PIN_04, BSP_IO_LEVEL_HIGH);
}

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.