Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <LiquidCrystal.h>
- const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
- LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
- const int lcdContrastPin = 6, lcdBackligthPin = 10;
- void setup()
- {
- // tutn on LCD backlight and contrast
- pinMode(lcdContrastPin, OUTPUT);
- pinMode(lcdBackligthPin, OUTPUT);
- // fine-tuning contrast could be done by PWM on lcdContrastPin
- digitalWrite(lcdContrastPin, LOW);
- digitalWrite(lcdBackligthPin, HIGH);
- lcd.begin(16, 2);
- // configure Timer1
- TCCR1A = 0; // no waveform generation
- TCCR1B = 0x00000010; // frequency divider 8 (i.e. counting with 2 MHz)
- TCCR1C = 0;
- TIFR1 = 0x00100000; // clear Input Capture Flag
- TCNT1 = 333;
- }
- void loop()
- {
- int currentTimerValue = TCNT1;
- lcd.setCursor(0, 0);
- lcd.print("TCNT1=");
- lcd.print(currentTimerValue);
- lcd.println(" ");
- delay(50);
- }
Advertisement
Add Comment
Please, Sign In to add comment