Hello all. I'm messing with some simple things to get a bit more familiar with this Arduino business.
I have the following code:
#include <Wire.h>
#include <Centipede.h>
#include <LCDI2C4Bit.h>
Centipede CS;
int ADDR=0x27;
LCDI2C4Bit lcd = LCDI2C4Bit(ADDR,2,16);
void setup(void){
Wire.begin();
Serial.begin(9600);
CS.initialize();
CS.pinMode(7, OUTPUT);
CS.pinMode(6,OUTPUT);
CS.pinMode(5, OUTPUT);
CS.pinMode(4, OUTPUT);
CS.pinMode(3, OUTPUT);
lcd.init();
lcd.clear();
}
void loop(){
blinkLED();
displayonLCD();
}
void blinkLED(){
CS.digitalWrite(7, HIGH);
CS.digitalWrite(5, HIGH);
CS.digitalWrite(3, HIGH);
CS.digitalWrite(6, LOW);
CS.digitalWrite(4, LOW);
delay(1000);
CS.digitalWrite(6, HIGH);
CS.digitalWrite(4, HIGH);
CS.digitalWrite(7, LOW);
CS.digitalWrite(5, LOW);
CS.digitalWrite(3, LOW);
delay(1000);
}
void displayonLCD(){
lcd.printIn("Arduino is good");
lcd.cursorTo(2,8);
lcd.printIn("for your brain! ");
delay(5000);
lcd.clear();
lcd.printIn("Tacos!");
delay(5000);
lcd.clear();
lcd.printIn("Burritos!");
delay(5000);
lcd.clear();
}
It blinks some LEDs, and displays different messages on an LCD screen. The problem is that with the delay()s in the LCD code the LEDs become so delayed that they don't really blink...they just shift postions when the program loops back around. I assume that timing issues like this might mess with me later when I'm trying to create better things, and I'd like to know if there is any way to fix this?
Thanks. ![]()