Hello, Im very confused with some of the examples Im using to learn about arrays. I have an array containing custom characters. I understand how to reference the data in an array. How ever, Im not getting any happy results with what Iv read and put together.
My desired result is to print out the data from the array shifted from left to right, or right to left in an increment as dictated by the position of a potentiometer. Meaning, for ever change in the value of the ohms, the array will move in a direction depending on if the resistance rises or drops. But... as the characters are shifted off the end of the array.. they are added onto the opposite end..
Like So :
Start position : ..S....W....N....E..
Rising : S...W....N....E....
Rising: ....W....N....E....S
Rising: ..W....N....E....S..
Rising : W....N....E....S....
This is the code I have been able to put together, and pass the verification, BUT I just cannot get around the If loop to get the
byte headN[8] = { B10001, B11001, B10101, B10011, B10001, B00100, B00100, B00100 }; // North Marker
byte headE[8] = { B01110, B01000, B01110, B01000, B01110, B00100, B00100, B00100 }; // East Marker
byte headS[8] = { B01110, B01000, B01110, B00010, B01110, B00100, B00100, B00100 }; // South Marker
byte headW[8] = { B10001, B10101, B10101, B01010, B01010, B00100, B00100, B00100 }; // West Marker
byte headA[8] = { B00000, B00000, B00000, B00100, B00100, B10101, B01110, B00100 }; // Heading Arrow
lcd.createChar(0, headA); // Defines Heading Arrow
lcd.createChar(1, headN); // Defines North Marker
lcd.createChar(2, headS); // Defines South Marker
lcd.createChar(3, headE); // Defines East Marker
lcd.createChar(4, headW); // Defines West Marker
byte *array[5] = {headA, headN, headS, headE, headW};
int CR; // Compass Rose
int CH; // Current heading from potentiometer
CH = 270; // Current Heading
CR = CH/1.3888 // This will divide the CH by 1.388 wich is the width of 1 character on the LCD.
I don't know how to shift the Array from this point.