I am tapping an AGC voltage into an analog input of the Raduino for an S-Meter, and it is working well to display "S9+5", for example, on line 2 of my BitX40. Now I am trying to add a bar-graphic to go with that using the custom graphics of the LCD, but not having success. Instead of graphics, I seem to be displaying each line of the defined graphic, like "11111" or something, and the formatting is off. I could use some help, since the bulk of my programming experience dates to BASIC on a TRS-80.
Here are snippits of what I am doing:
? char c[17], b[10], smeterstring[7], printBuff[2][17]; ? ?? //added smeterstring for printing AGC value
? int sbar = 0;?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //define a marker for graphic smeter
// Define smeter characters for graphics
? byte S3[8] = {
??? B00000,
??? B00000,
??? B00000,
??? B00000,
??? B00000,
??? B00000,
??? B10000,
? };
? byte S4[8] = {
??? B00000,
??? B00000,
??? B00000,
??? B00000,
??? B00000,
??? B00100,
??? B10100,
? };
... etc., etc....
void setup() {
...
? lcd.begin(16, 2);
? // load special smeter characters to be used in smeter graphic
? lcd.createChar(0, S3);
? lcd.createChar(1, S4);
? lcd.createChar(2, S5);
...etc. etc....
void loop() {
...
????? // start getting some AGC S-Meter stuff
????? smeter = analogRead(A6); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?? // get smeter AGC value
?????????? // Figure an S-meter value to display
??????????? if (smeter<4) {
????????????? strcpy(smeterstring , "S3??? ");
????????????? sbar = 0;
????????????? }
??????????? if (smeter>=4 && smeter<5) {
????????????? strcpy(smeterstring , "S4??? ");
????????????? sbar = 1;
??????????? }
??????????? if (smeter>=5 && smeter<6) {
????????????? strcpy(smeterstring , "S5??? ");
????????????? sbar = 2;
etc. etc...
lcd.setCursor(0,1);
??????????? lcd.print(1, smeterstring);
??????????? switch (sbar) {??????????????????????? //print graphics for smeter after numerical value
????????????? case 0:
????????????? lcd.write(byte(0));
????????????? lcd.print(1,"? ");
????????????? break;
?????????????
????????????? case 1:
????????????? lcd.write(byte(1));
????????????? lcd.print(1,"? ");
????????????? break;
?????????????
????????????? case 2:
????????????? lcd.write(byte(2));
????????????? lcd.print(1,"? ");
????????????? break;
...etc. etc...
}
So, the basic problem seems to be that my defined characters are not being defined. What am I doing wrong, here?
=VIc=