Vic,
I forgot to mention also that I had to use memcpy instead of strcpy to copy the S-meter character array into the LCD buffer string for the characters to be displayed. See extracts of the code below.
73, John
Note: this is a "fat" meter with one bar per character, but it can be changed for a "thin" two bars per character like on your picture.
//VK2ETA meter for S.Meter, power and SWR
//'S' or 'P' pr 'R' then 0 to 6 growing bars, then '+' or '++' if over S9/Max Power/SWR of 10
//needle valid range 0-8
void drawMeter(int needle) {
?
? //Fill buffer with growing set of bars, up to needle value
? for (int i = 0; i < 6; i++) {
? ? if (needle > i)
? ? ? lcdMeter[i] = byte(i + 1); //Custom characters above
? ? else
? ? ? lcdMeter[i] = 0x20; //blank
? }
?
? if (needle > 7) {
? ? lcdMeter[6] = byte(7); //Custom character "++"
? } else if (needle > 6) {
? ? lcdMeter[6] = 0x2B; //"+"
? } else lcdMeter[6] = 0x20;
}
//meterType : 0 = S.Meter, 1 = Forward Power Meter, 2 = SWR Meter
void DisplayMeter(byte meterType, byte meterValue, char drawPosition)
{
?
? drawMeter(meterValue);?
? //Always line 2
? char sym = 'S';
? if (meterType == 1) sym = 'P';
? else if (meterType == 2) sym = 'R';
? line2Buffer[drawPosition] = sym;
? memcpy(&(line2Buffer[drawPosition + 1]), lcdMeter, 7);
}
?