RAK11310 digital input read issues

Hi, I’m trying to read the state of two relays using a RAK11310 mounted to a RAK19010 without success.

I’ve been using the sketch below to troubleshoot,
The relays are connected between pins IO1\IO2 and ground but always return a state of 0, I added the analog input to further troubleshoot and that always returns 1, this happens even if I set the digitalWrites to LOW.

void setup() {
  time_t timeout = millis();
  while (!Serial) {
    if ((millis() - timeout) < 5000) {
    } else {

  pinMode(WB_A0, INPUT);
  pinMode(WB_IO1, INPUT);
  pinMode(WB_IO2, INPUT);

  digitalWrite(WB_A0, HIGH);
  digitalWrite(WB_IO1, HIGH);
  digitalWrite(WB_IO2, HIGH);

void loop() {
  int WB_A0State = digitalRead(WB_A0);
  int WB_IO1State = digitalRead(WB_IO1);
  int WB_IO2State = digitalRead(WB_IO2);

  Serial.println(" ");

Any pointers would be greatly appreciated, Thanks.

Welcome to RAK forum @SamSkjord ,

The title you put is RAK13003 but I do not see it in your message. It seems you are using RAK11310 IO pins. Can you confirm?

Regarding your question.

Can you share the circuit/schematic? Do you have any pullup resistor on the input pins?

Hi Carl, you’re correct! updated the title.

Rough sketch below, I haven’t added any pullups as I believed

digitalWrite(WB_IO1, HIGH);

did this internally?

Hi @SamSkjord ,

I haven’t looked deeper on RP2040 and Arduino Mbed port but you can try to enable an internal pullup using this pinMode(WB_A0, INPUT_PULLUP);

If this doesn’t work, you will need an external pull up so that the pins are not left floating.

1 Like

That works perfectly now, thanks for your help

Refer to the RAK11310 documentation to ensure that you are using the correct methods for reading digital inputs. Sometimes, specific modules may have unique requirements.

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