I am working on automating my aquarium with an arduino. I want to include an lcd to see the status of the arduino. everything works alright except I am getting weird bars after my printing? I attached the code and a picute of the bars. I am using this lcd http://www.amazon.com/SainSmart-Module-Arduino-Board-White/dp/B003B22UR0/ref=sr_1_2?ie=UTF8&qid=1433077977&sr=8-2&keywords=sainsmart+lcd
//these are for the alarm portion
#include <TimeAlarms.h>
#include <Time.h>
//these are for the lcd portion
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#define I2C_ADDR 0x27
#define BACKLIGHT_PIN 3
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7
LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);
void setup()
{
//these are for the alarm portion
Serial.begin(9600);
setTime(8,29,55,5,28,15); // set time to whatever
// create the alarms
Alarm.alarmRepeat(8,30,00, ActinicONam); // 8:30am every day actinic lights on
Alarm.alarmRepeat(8,30,05, ActinicOFFam); // 9:29am every day actinic lights off
Alarm.alarmRepeat(8,30,10, DaytimeON); // 9:30am every day daytime lights on
Alarm.alarmRepeat(8,30,15, PowerheadOFFam); // 9:59am every day powerhead off
Alarm.alarmRepeat(8,30,20, FeedAM); // 10:00am every day feed fish
Alarm.alarmRepeat(8,30,25, PowerheadONam); // 10:05am every day powerhead on
Alarm.alarmRepeat(8,30,30, PowerheadOFFpm); // 4:59pm every day powerhead off
Alarm.alarmRepeat(8,30,35, FeedPM); // 5:00pm every day feed fish
Alarm.alarmRepeat(8,30,40, PowerheadONpm); // 5:05pm every day powerhead on
Alarm.alarmRepeat(8,30,45, DaytimeOFF); // 5:29pm every day daytime lights off
Alarm.alarmRepeat(8,30,50, ActinicONpm); // 5:30pm every day actinic lights on
Alarm.alarmRepeat(8,30,55, ActinicOFFpm); // 8:30am every day actinic lights off
//these are for the relay board
pinMode(9, OUTPUT); //actinic lights relay (channel 1)
pinMode(10, OUTPUT); //daytime lights relay (channel 2)
pinMode(11, OUTPUT); //powerhead relay (channel 3)
pinMode(12, OUTPUT); //feeder relay (channel 4)(soon to be changed to servo or stepper)
//these are for the relay board
digitalWrite(9, LOW); //start with actinic lights off
digitalWrite(10, LOW); //start with daytime lights off
digitalWrite(11, HIGH); //start with powerhead on
digitalWrite(12, LOW); //do not feed yet
//these are for the lcd portion
lcd.begin (20,4,LCD_5x8DOTS);
lcd.setCursor(0,2);
lcd.print("Status: ACTIVE");
lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
}
void loop(){
lcd.setBacklight(HIGH);
digitalClockDisplay();
Alarm.delay(1000); // wait 30 seconds between clock display
}
// functions to be called when an alarm triggers:
void ActinicONam(){
lcd.setCursor(0,0);
lcd.println("Actinic lights on!");
digitalWrite(9, HIGH);
}
void ActinicOFFam(){
lcd.setCursor(0,0);
lcd.println("Actinic lights off!");
digitalWrite(9, LOW);
}
void DaytimeON(){
lcd.setCursor(0,0);
lcd.println("Daytime lights on!");
digitalWrite(10, HIGH);
}
void PowerheadOFFam(){
lcd.setCursor(0,0);
lcd.println("Prepare for feeding.");
digitalWrite(11, LOW);
}
void FeedAM(){
lcd.setCursor(0,0);
lcd.println("Fish are fed!");
digitalWrite(12, HIGH);
delay(1000);
digitalWrite(12, LOW);
}
void PowerheadONam(){
lcd.setCursor(0,0);
lcd.println("Ocean stirring");
digitalWrite(11, HIGH);
}
void PowerheadOFFpm(){
lcd.setCursor(0,0);
lcd.println("Prepare for feeding.");
digitalWrite(11, LOW);
}
void FeedPM(){
lcd.setCursor(0,0);
lcd.println("Fish are fed!");
digitalWrite(12, HIGH);
delay(1000);
digitalWrite(12, LOW);
}
void PowerheadONpm(){
lcd.setCursor(0,0);
lcd.println("Ocean stirring");
digitalWrite(11, HIGH);
}
void DaytimeOFF(){
lcd.setCursor(0,0);
lcd.println("Daytime lights off!");
digitalWrite(10, LOW);
}
void ActinicONpm(){
lcd.setCursor(0,0);
lcd.println("Actinic lights on!");
digitalWrite(9, HIGH);
}
void ActinicOFFpm(){
lcd.setCursor(0,0);
lcd.println("Actinic lights off!");
digitalWrite(9, LOW);
}
void digitalClockDisplay()
{
// digital clock display of the time
lcd.setCursor(0,1);
lcd.print(hour());
printDigits(minute());
printDigits(second());
lcd.println();
}
void printDigits(int digits)
{
lcd.print(":");
if(digits < 10)
lcd.print('0');
lcd.print(digits);
}