Hi there,
I’ve been trying to read the digital input pins IO1 & IO2 on the RAK4631 (RAK4630 core + RAK5005-0 base board) but for some reason I can’t get them to read. I’m probably having a noob moment - can anyone tell me what I’m doing wrong?
I’ve pasted my code below. It compiles and loads successfully. I can get the onboard LEDs to flash on and off (using a separate program).
I’ve tried with and without external pullup and pulldown resistors on the two pins, and in my latest code seen below I tried the internal pullups. I’ve even tried just quickly touching the pins directly to the VDD pin and the GND pins to check for any response but nothing happens. Note i’m interfacing the two pins on the RAK5005 breakout board at connector J11.
I’m using Arduino 1.8.16 IDE on Windows 10 Pro. Thanks all.
#include <Arduino.h>
#include <SPI.h>
#include <Wire.h>
void setup()
{
pinMode(LED_BLUE, OUTPUT);
pinMode(WB_IO1, INPUT);
pinMode(WB_IO2, INPUT);
digitalWrite(LED_BLUE, LOW);
digitalWrite(WB_IO1, HIGH);
digitalWrite(WB_IO2, HIGH); // Optional Internal Pull-Up
Serial.begin(9600);
}
void loop ()
{
if ((WB_IO1 == LOW) || (WB_IO2 == LOW)) {
digitalWrite(LED_BLUE, HIGH);
}
else {
digitalWrite(LED_BLUE, LOW);
}
}