Go Down

Topic: LCD Screen and LED no longer blinking when changing power sources (Read 574 times) previous topic - next topic

predzZzZzZ

I am using a 20x4 LCD screen to display certain recorded values. I get it to work when it is connected to my computer, however, once I change it to be plugged into a battery or wall outlet the display just displays white boxes on the 1st and 3rd rows. I have clearly updated a code to it but it still doesn't work. The led that I have connected also doesn't blink when it is plugged into battery or wall outlet either. I was wondering why the difference in output when power source changes and any potential fixes. Thank you in advance.

LCD Screen: https://www.amazon.com/gp/product/B0080DYTZQ/ref=s9u_simh_gw_i1?ie=UTF8&fpl=fresh&pd_rd_i=B0080DYTZQ&pd_rd_r=fae5e15f-fe1f-11e7-bd6b-0356965b604e&pd_rd_w=hHfld&pd_rd_wg=jsWEF&pf_rd_m=ATVPDKIKX0DER&pf_rd_s=&pf_rd_r=0JQ9RET26YK58SP17G92&pf_rd_t=36701&pf_rd_p=d9f78c36-24d5-402e-866f-a50358a0504c&pf_rd_i=desktop

LED: https://www.amazon.com/gp/product/B00KWGJWYM/ref=oh_aui_detailpage_o05_s00?ie=UTF8&psc=1

Code: [Select]

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

LiquidCrystal_I2C lcd(0x27,2,1,0,4,5,6,7);

const int ledPin = 13;

int ledState = LOW;

unsigned long previousMillis = 0;

void setup() {
  pinMode(ledPin, OUTPUT);
  lcd.setBacklightPin(3,POSITIVE);
  lcd.setBacklight(HIGH);
  lcd.begin(16, 2);
  lcd.setCursor(0,0);
  Serial.begin(9600);
  lcd.print("RPM = ");
  lcd.setCursor(0,1);
  lcd.print("Temp (F) = ");
  lcd.setCursor(20,0);
  lcd.print("Bearing Life = ");
}

void loop() {
  unsigned int interval = analogRead(A2);

  unsigned long currentMillis = millis();

  if (currentMillis - previousMillis >= interval) {
    previousMillis = currentMillis;
    lcd.setCursor(6,0);
    lcd.print(interval);
    digitalWrite(ledPin, !digitalRead(ledPin));
  }
}

ieee488

You have not shown how the LEDs and LCD are connected to your Arduino and to your power source.

Did you think that does not matter?

predzZzZzZ

You have not shown how the LEDs and LCD are connected to your Arduino and to your power source.

Did you think that does not matter?
The power source is from the power jack using a wall adapter, and the other is from the USB connector. To answer your question yes I do think it matters, however it works completely fine when it is connected via USB to my computer, but not on the power jack. I can post pictures however I do not see why that would change the output.

ieee488

The power source is from the power jack using a wall adapter, and the other is from the USB connector. To answer your question yes I do think it matters, however it works completely fine when it is connected via USB to my computer, but not on the power jack. I can post pictures however I do not see why that would change the output.
Yeah photos.

predzZzZzZ

Here are some images I have included.

predzZzZzZ

These two images exceeded file size on the last post.

Wawa

It seems that the pot is plugged into the wrong holes of the breadboard.
Leo..

Go Up