Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <LiquidCrystal.h>
- LiquidCrystal lcd(9, 8, 7, 10, 5, 4);
- int lcdkontrast = 110;
- int pin = 13;
- int zeit;
- int poti;
- int frequenz;
- void setup() {
- poti = A0;
- lcd.begin(16, 2);
- analogWrite(6, lcdkontrast);
- pinMode(pin, OUTPUT);
- }
- void loop() {
- zeit = map(poti, 0, 1023, 500, 5); //bei potiwert 0: 500ms an und 500ms aus also eine sekunde was dann 1 Hz wären,
- digitalWrite(pin, HIGH);
- delay(zeit);
- digitalWrite(pin, LOW);
- delay(zeit);
- frequenz = map (zeit, 500, 5, 1, 100);
- char buffer[7];
- sprintf(buffer,"%4i Hz",frequenz);
- lcd.setCursor(0, 0);
- lcd.print("Frequenz");
- lcd.setCursor(0, 1);
- lcd.print(buffer);
- lcd.setCursor(0, 1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement