====== Input and Output Control (FADUINO-18TA / 32TA) ======
The following program will read input 22 and transfer its state to the status LED and output 38.
const int StatusLED = 13;
const int Sink38 = 38;
const int Input_22 = 22;
void setup() {
pinMode(StatusLED, OUTPUT);
pinMode(Sink38 , OUTPUT);
pinMode(Input_22 , INPUT );
}
void loop() {
if(HIGH==digitalRead(Input_22 )) {
digitalWrite(StatusLED, HIGH);
digitalWrite(Sink38 , HIGH);}
else {
digitalWrite(StatusLED, LOW);
digitalWrite(Sink38 , LOW);
}
}
====== Input and Output Control (FADUINO-12RA / 24RA) ======
The following program will read input 4 and transfer its state to the status LED and output relay 22.
const int StatusLED = 13;
const int Relay22 = 22;
const int Input_4 = 4;
void setup() {
pinMode(StatusLED, OUTPUT);
pinMode(Relay22, OUTPUT);
pinMode(Input_4, INPUT );
}
void loop() {
if(HIGH==digitalRead(Input_4)) {
digitalWrite(StatusLED, HIGH);
digitalWrite(Relay22, HIGH);}
else {
digitalWrite(StatusLED, LOW);
digitalWrite(Relay22, LOW);
}
}
[[faduino:index|FADUINO]]