/*
Seppe Foulon 6 5MTR
▐▓█▀▀▀▀▀▀▀▀▀█▓▌░▄▄▄▄▄░
▐▓█░░▀░░▀▄░░█▓▌░█▄▄▄█░
▐▓█░░▄░░▄▀░░█▓▌░█▄▄▄█░
▐▓█▄▄▄▄▄▄▄▄▄█▓▌░█████░
░░░░▄▄███▄▄░░░░░█████░
*/
#include <LiquidCrystal.h>
//Definieren van variabelen
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int mode_up=6;
const int mode_down=7;
const int mode_reset=8;
const int led=9;
int mode=1;
bool check_up;
bool check_down;
bool check_reset;
#define POTENTIOMETER A0
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);//we zetten de seriele monitor aan
lcd.begin(16, 2);
pinMode(mode_up,INPUT_PULLUP);
pinMode(mode_down,INPUT);
pinMode(mode_reset,INPUT);
pinMode(led,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
lcd_screen();
input_checker();
mode_checker();
}
void lcd_screen(){
switch(mode){
case 1:
lcd.clear();
lcd.setCursor(0,0);
lcd.print("mode: ");
lcd.setCursor(0,1);
lcd.print("brightness: ");
lcd.setCursor(10,0);
lcd.print("Normal");
lcd.setCursor(9,0);
lcd.print(mode);
lcd.setCursor(14,1);
break;
case 2:
lcd.clear();
lcd.setCursor(0,0);
lcd.print("mode: ");
lcd.setCursor(0,1);
lcd.print("brightness: ");
lcd.setCursor(11,0);
lcd.print("Night");
lcd.setCursor(10,0);
lcd.print(mode);
break;
case 3:
lcd.clear();
lcd.setCursor(0,0);
lcd.print("mode: ");
lcd.setCursor(0,1);
lcd.print("brightness: ");
lcd.setCursor(12,0);
lcd.print("Read");
lcd.setCursor(11,0);
lcd.print(mode);
break;
case 4:
lcd.clear();
lcd.setCursor(0,0);
lcd.print("mode: ");
lcd.setCursor(0,1);
lcd.print("brightness: ");
lcd.setCursor(8,0);
lcd.print(mode);
lcd.setCursor(9,0);
lcd.print("Romance");
lcd.setCursor(14,1);
break;
deflault:
lcd.setCursor(0,0);
lcd.print("mode: ");
lcd.setCursor(0,1);
lcd.print("brightness: ");
break;
}
}
void input_checker(){
check_up=digitalRead(mode_up);
check_down=digitalRead(mode_down);
check_reset=digitalRead(mode_reset);
Serial.println(check_up);
Serial.println(check_down);
Serial.println(check_reset);
}
void mode_checker(){
Serial.println("Welke lamp modus wilt u hebben? Normal(1), Night(2), Read(3), Romance(4)");
delay(1000);
if(check_up==LOW){
mode+=1;
}
else if(check_down==HIGH){
mode-=1;
}
else if (check_reset==HIGH){
mode=1;
}
}