Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wire.h>
- #include <LCD.h>
- #include <LiquidCrystal_I2C.h>
- LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
- int getal = 0;
- int getalUIT = 0;
- int knopStatus = 0;
- const int knopPin = 2;
- void setup() {
- pinMode(knopPin, INPUT);
- lcd.begin(16,2);
- lcd.setCursor(2, 0);
- lcd.print("Fietsen naar");
- lcd.setCursor(4, 1);
- lcd.print("Burrundi!");
- delay(100);
- }
- void loop() {
- knopStatus = digitalRead(knopPin);
- if (knopStatus == HIGH) {
- getal=getal+10;
- }
- if (getal == 0) {
- } else if (getal >= 1000) {
- if(getal >= 1000 && getal < 1100) {
- lcd.clear();
- lcd.setCursor(3,0);
- lcd.print("Er is ");
- lcd.print(getal/1000);
- lcd.print(",0");
- lcd.print((getal%1000)/10);
- lcd.setCursor(13, 0);
- lcd.print("km");
- lcd.setCursor(3,1);
- lcd.print("afgelegd!");
- } else {
- lcd.clear();
- lcd.setCursor(3,0);
- lcd.print("Er is ");
- lcd.print(getal/1000);
- lcd.print(",");
- lcd.print((getal%1000)/10);
- lcd.setCursor(13, 0);
- lcd.print("km");
- lcd.setCursor(3,1);
- lcd.print("afgelegd!");
- }
- } else {
- lcd.clear();
- lcd.setCursor(3,0);
- lcd.print("Er is ");
- lcd.print(getal);
- lcd.setCursor(13, 0);
- lcd.print("m");
- lcd.setCursor(3,1);
- lcd.print("afgelegd!");
- }
- delay(150);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement