Guest User

Untitled

a guest
Feb 15th, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.81 KB | None | 0 0
  1. #include <Wire.h>  
  2. #include <LiquidCrystal_I2C.h>
  3.  
  4. LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
  5.  
  6.  
  7. unsigned long aktMillis, altMillis, Imp;
  8. const unsigned int torzeit = 1000;
  9. bool aktStatus, altStatus;
  10.  
  11. void setup() {
  12.   lcd.begin(20,4);
  13.   pinMode(2, INPUT); //Pin 2
  14.   pinMode(13, OUTPUT);
  15.   aktStatus = digitalRead(2);
  16.   altStatus = aktStatus;
  17. }
  18.  
  19. void loop() {
  20.   aktMillis = millis();
  21.   aktStatus = digitalRead(2);
  22.   if (altStatus && !aktStatus) Imp++;
  23.   altStatus = aktStatus;
  24.   if (aktMillis - altMillis >= torzeit) {
  25.     altMillis = aktMillis;
  26.     lcd.setCursor(0,0);
  27.     lcd.print("Impulse = ");
  28.     lcd.print(Imp); lcd.println(" Imp/s    ");
  29.     Imp = 0;
  30.   }
  31.  
  32. // ab hier stimmt was nicht:
  33.  
  34.   float z;
  35.   z= Imp *7.5 / 60;
  36.   lcd.setCursor(0,2);  
  37.   lcd.print(z,2);
  38.   }
Add Comment
Please, Sign In to add comment