Hi!
I having some trouble getting this code working. I cant see why!
It is suppose to work like this:
- The cup has to stay on all the time
- The stream have to switch between the to str animations
Here is my code
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins:
LiquidCrystal lcd(11, 10, 5, 4, 3, 2);
// setting animation speed (delay between frames)
int x = 500;
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(20,4);
// clear the LCD screen:
lcd.clear();
}
void loop() {
cup();
strA();
delay(x);
strB();
delay(x);
}
void cup() {
byte cup1[8] = {B00000,B00000,B00000,B00000,B11111,B11111,B11111,B11111};
byte cup2[8] = {B11111,B11111,B11111,B11111,B01111,B00111,B00001,B00000};
byte cup3[8] = {B00000,B00000,B00000,B00000,B11111,B11111,B11111,B11111};
byte cup4[8] = {B11111,B11111,B11111,B11111,B11111,B11111,B11111,B00000};
byte cup5[8] = {B00000,B00000,B00000,B00000,B11111,B11111,B11111,B11111};
byte cup6[8] = {B11111,B11111,B11111,B11111,B11110,B11100,B10000,B00000};
byte cup7[8] = {B00000,B00000,B00000,B00000,B00000,B00000,B11100,B00110};
byte cup8[8] = {B00110,B11100,B00000,B00000,B00000,B00000,B00000,B00000};
lcd.createChar(0, cup1);
lcd.createChar(1, cup2);
lcd.createChar(2, cup3);
lcd.createChar(3, cup4);
lcd.createChar(4, cup5);
lcd.createChar(5, cup6);
lcd.createChar(6, cup7);
lcd.createChar(7, cup8);
lcd.setCursor(8,2);
lcd.write(0);
lcd.setCursor(8,3);
lcd.write(1);
lcd.setCursor(9,2);
lcd.write(2);
lcd.setCursor(9,3);
lcd.write(3);
lcd.setCursor(10,2);
lcd.write(4);
lcd.setCursor(10,3);
lcd.write(5);
lcd.setCursor(11,2);
lcd.write(6);
lcd.setCursor(11,3);
lcd.write(7);
}
void strA() {
byte str1[8] = {B01110,B01110,B01110,B00000,B00000,B00000,B00000,B00000};
byte str2[8] = {B01110,B01110,B01110,B00000,B00000,B00000,B00000,B00000};
lcd.createChar(0, str1);
lcd.createChar(1, str2);
lcd.setCursor(9,0);
lcd.write(0);
lcd.setCursor(9,1);
lcd.write(1);
}
void strB() {
byte str1[8] = {B00000,B00000,B00000,B00000,B01110,B01110,B01110,B01110};
byte str2[8] = {B00000,B00000,B00000,B00000,B01110,B01110,B01110,B01110};
lcd.createChar(0, str1);
lcd.createChar(1, str2);
lcd.setCursor(9,0);
lcd.write(0);
lcd.setCursor(9,1);
lcd.write(1);
}
And here is how it works...
Any ideas?!