Jump to content

LCD not working

Yacovrex

Why is the LCS Screen with i2c not working?

int ledPin = 13;                // IR LED connected to digital pin 13
volatile byte rpmcount;
unsigned int rpm;
unsigned long timeold;

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x20,16,2);

void rpm_fun()
 {
   //Each rotation, this interrupt function is run twice, so take that into consideration for 
   //calculating RPM
   //Update count
      rpmcount++;
 }

void setup()
 {
   lcd.init();
   lcd.backlight();


   //Interrupt 0 is digital pin 2, so that is where the IR detector is connected
   //Triggers on FALLING (change from HIGH to LOW)
   attachInterrupt(0, rpm_fun, FALLING);

   //Turn on IR LED
   pinMode(ledPin, OUTPUT);
   digitalWrite(ledPin, HIGH);

   rpmcount = 0;
   rpm = 0;
   timeold = 0;
 }

 void loop()
 {
   //Update RPM every second
   delay(1000);
   //Don't process interrupts during calculations
   detachInterrupt(0);
   //Note that this would be 60*1000/(millis() - timeold)*rpmcount if the interrupt
   //happened once per revolution instead of twice. Other multiples could be used
   //for multi-bladed propellers or fans
   rpm = 30*1000/(millis() - timeold)*rpmcount;
   timeold = millis();
   rpmcount = 0;

   //Print out result to lcd
   lcd.clear();
   lcd.print("RPM=");
   lcd.print(rpm);

   //Restart the interrupt processing
   attachInterrupt(0, rpm_fun, FALLING);
  }

                           Gaming PC:                                        Server PC:                                         Streaming PC:

Processors:        i9-10900k                                          i5-9600k                                             i7-5820k

Motherboards:    ASUS ROG STRIX Z490-E               ASUS ROG STRIX Z390-E                ASUS ROG STRIX X99

RAM:                  Gskill TridentZ 32 GB @3500mhz    Gskill TridentZ 32 GB @3500mhz      Gskill TridentZ 32 GB @3500mhz

GPU:                  MSI RTX 3080ti                                 Asus ROG 1050ti                               Asus ROG 1060 OC

SSD:                  Samsung 980 Pro                             Samsung 960 Evo                              Samsung 960 Evo

PSU:                  ROG Thor 1200W                             ROG Thor 850W                                 ROG Thor 850W

CPU Cooler:      Corsair hardline                                 Corsair hardline                                  Corsair hardline

Case:                 Custom                                              Custom                                               Custom

Link to comment
Share on other sites

Link to post
Share on other sites

Context would be helpful. What are you using to control your lcd. Pi, CHIP, Arduino ect.

CPU: Intel i7 - 5820k @ 4.5GHz, Cooler: Corsair H80i, Motherboard: MSI X99S Gaming 7, RAM: Corsair Vengeance LPX 32GB DDR4 2666MHz CL16,

GPU: ASUS GTX 980 Strix, Case: Corsair 900D, PSU: Corsair AX860i 860W, Keyboard: Logitech G19, Mouse: Corsair M95, Storage: Intel 730 Series 480GB SSD, WD 1.5TB Black

Display: BenQ XL2730Z 2560x1440 144Hz

Link to comment
Share on other sites

Link to post
Share on other sites

arduno uno

                           Gaming PC:                                        Server PC:                                         Streaming PC:

Processors:        i9-10900k                                          i5-9600k                                             i7-5820k

Motherboards:    ASUS ROG STRIX Z490-E               ASUS ROG STRIX Z390-E                ASUS ROG STRIX X99

RAM:                  Gskill TridentZ 32 GB @3500mhz    Gskill TridentZ 32 GB @3500mhz      Gskill TridentZ 32 GB @3500mhz

GPU:                  MSI RTX 3080ti                                 Asus ROG 1050ti                               Asus ROG 1060 OC

SSD:                  Samsung 980 Pro                             Samsung 960 Evo                              Samsung 960 Evo

PSU:                  ROG Thor 1200W                             ROG Thor 850W                                 ROG Thor 850W

CPU Cooler:      Corsair hardline                                 Corsair hardline                                  Corsair hardline

Case:                 Custom                                              Custom                                               Custom

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×