/*This software is provided in an “AS IS” condition,NO WARRANTIES in any form apply to this software. picmicrolab.com 10.29.2017 *************************************************************************************************************** Basic Arduino Frequency Counter */ // include the library code: #include // initialize the library by associating any needed LCD interface pin // with the arduino pin number it is connected to const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2; LiquidCrystal lcd(rs, en, d4, d5, d6, d7); long int Time = 0; void setup() { // initialize I/O pins. pinMode(13, INPUT); // // set up the LCD's number of columns and rows: lcd.begin(16, 2); } void loop() { for(int i = 0;i<500;i++) Time = Time + pulseIn(13, LOW); Time = Time / 501; // Turn on the display: lcd.display(); lcd.print(1/(0.000001*Time*2));// lcd.print(" Hz ");// Time = 0; lcd.setCursor(0, 0); // top left }