<>// include the library code:
#include <LiquidCrystal.h>
// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
// constants won't change. They're used here to set pin numbers:
const int inputPin1 = 23; // ingang 1
const int outputPin1 = 22; // uitgang 1
const int inputPin2 = 25; // ingang 2
const int outputPin2 = 24; // uitgang 2
const int inputPin3 = 27; // ingagn 3
const int outputPin3 = 26; // uitgang 3
const int inputPin4 = 29; // ingang 4
const int outputPin4 = 28; // uitgang 4
const int inputPin5 = 31; // ingang 5
const int outputPin5 = 30; // uitgang 5
const int inputPin6 = 33; // ingang 6
const int outputPin6 = 32; // uitgang 6
const int inputPin7 = 35; // ingang 7
const int outputPin7 = 34; // uitgang 7
const int inputPin8 = 37; // ingang 8
const int outputPin8 = 36; // uitgang 8
// variables will change
int buttonState = 0; // variable for reading the pushbutton status
void setup() {
{
// set up the LCD's number of columns and rows:
lcd.begin(20, 4);
lcd.print("TRAPPE");
lcd.setCursor(11, 0);
lcd.print("GARAGE");
lcd.setCursor(0, 1);
lcd.print("L.HAL");
lcd.setCursor(11, 1);
lcd.print("S.HAL");
lcd.setCursor(0, 2);
lcd.print("KORR");
lcd.setCursor(11, 2);
lcd.print("VASKER");
lcd.setCursor(0, 3);
lcd.print("GARAGEP");
lcd.setCursor(11, 3);
lcd.print("DYR");
};
void loop()
// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
(if (digitalRead(inputPin1) == LOW))
{
digitalWrite(outputPin1, HIGH);
} else {
// turn LED off:
digitalWrite(outputPin1, LOW);
// read the state of the pushbutton value:
buttonState = digitalRead(inputPin1);
// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (inputPin2 == HIGH) {
// turn LED on:
digitalWrite(outputPin2, HIGH);
} else {
// turn LED off:
digitalWrite(outputPin2, LOW);
}
// read the state of the pushbutton value:
buttonState = digitalRead(inputPin1);
// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (inputPin3 == HIGH) {
// turn LED on:
digitalWrite(outputPin3, HIGH);
} else {
// turn LED off:
digitalWrite(outputPin3, LOW);
}
// read the state of the pushbutton value:
buttonState = digitalRead(inputPin1);
// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (inputPin4 == HIGH) {
// turn LED on:
digitalWrite(outputPin4, HIGH);
} else {
// turn LED off:
digitalWrite(outputPin4, LOW);
}
// read the state of the pushbutton value:
buttonState = digitalRead(inputPin1);
// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (inputPin5 == HIGH) {
// turn LED on:
digitalWrite(outputPin5, HIGH);
} else {
// turn LED off:
digitalWrite(outputPin5, LOW);
}
// read the state of the pushbutton value:
buttonState = digitalRead(inputPin1);
// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (inputPin6 == HIGH) {
// turn LED on:
digitalWrite(outputPin6, HIGH);
} else {
// turn LED off:
digitalWrite(outputPin6, LOW);
}
// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (inputPin7 == HIGH) {
// turn LED on:
digitalWrite(outputPin7, HIGH);
} else {
// turn LED off:
digitalWrite(outputPin7, LOW);
}
// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (inputPin8 == HIGH) {
// turn LED on:
digitalWrite(outputPin8, HIGH);
} else {
// turn LED off:
digitalWrite(outputPin8, LOW);>
het is slechts het begin maar ik krijg hier al steeds n foutmelding