Digital Inputs and Outputs on an Ardbox Q Lite: full example
The simplest program for the Ardbox Q Lite: when input I0.0 turns on, the output follows it.
What it does
The microcontroller reads input I0.0 every 10 ms and copies its state to the output: digital output Q0.0 on the Ardbox Q Lite AD, relay R1 on the Ardbox Q Lite ADR. The same sketch works on both versions.
What you need
- Ardbox Q Lite AD or ADR with a 12 to 24 Vdc supply.
- Arduino IDE 2.0+ with the Industrial Shields boards package (board: Ardbox Q, your version).
How to run it
- Upload 01-digital-io.ino with Arduino IDE.
- Switch I0.0 on and off and check that the output follows it.
01-digital-io.ino
/*
Ardbox Q Lite example 01: digital inputs and outputs
When input I0.0 is on, the output turns on:
- Ardbox Q Lite AD: digital output Q0.0
- Ardbox Q Lite ADR: relay R1
Board: Ardbox Q, choose your version (AD or ADR) in Tools > CPU.
*/
#if defined(IS_ARDBOX_Q_RELAY)
const pin_size_t OUT = R1; // Ardbox Q Lite ADR
#else
const pin_size_t OUT = Q0_0; // Ardbox Q Lite AD
#endif
void setup() {
pinMode(I0_0, INPUT);
pinMode(OUT, OUTPUT);
}
void loop() {
digitalWrite(OUT, digitalRead(I0_0));
delay(10);
}