Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wire.h>
- #include <LiquidCrystal_I2C.h>
- LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
- unsigned long aktMillis, altMillis, Imp;
- const unsigned int torzeit = 1000;
- bool aktStatus, altStatus;
- void setup() {
- lcd.begin(20,4);
- pinMode(2, INPUT); //Pin 2
- pinMode(13, OUTPUT);
- aktStatus = digitalRead(2);
- altStatus = aktStatus;
- }
- void loop() {
- aktMillis = millis();
- aktStatus = digitalRead(2);
- if (altStatus && !aktStatus) Imp++;
- altStatus = aktStatus;
- if (aktMillis - altMillis >= torzeit) {
- altMillis = aktMillis;
- lcd.setCursor(0,0);
- lcd.print("Impulse = ");
- lcd.print(Imp); lcd.println(" Imp/s ");
- Imp = 0;
- }
- // ab hier stimmt was nicht:
- float z;
- z= Imp *7.5 / 60;
- lcd.setCursor(0,2);
- lcd.print(z,2);
- }
Add Comment
Please, Sign In to add comment