Hi all,
Please forgive how basic this is, I'm aware the knowledge needed can be found in books etc but I can't grasp this on my own.
I'm trying to take input from a PS/2 keyboard (which works printing char's to an LCD just fine), and write each character into the array 'message', until it is full.
I've tried compiling the code below, but the ouput says a 'const char*' can't be written to an entity of type 'char'. Does anyone know why this is please? The main line of interest is line 20, with the note next to it.
Any help would be much appreciated. Thanks.
Simon
#include "mbed.h"
#include "PS2ASCII.h"
#include "TextLCD.h"
PS2ASCII myKeyboard(p9, p10);
TextLCD lcd(p24, p25, p26, p27, p28, p29, p30,20,4);
DigitalOut LED(LED1);
Serial mbed2(p13 ,p14);
char message[20];
int i;
int charcount;
int main()
{
while (1) {
char symbol = myKeyboard.getChar();
//insert something here to watch for a carriage return line feed
//insert something here to initialise write loop for the message array, to send over serial
//do this loop for however many characters charcount says
for (i=0; message[i]; i++) //move to the next progressive char of the message array
message[i]="%c", symbol; //*NOT SURE ON THIS LINE* write symbol to this char in the message array
//increase charcount by one
if(myKeyboard.E0flag() == true) { //is the make code one or two bytes long?
lcd.printf(" E0 ");
LED = 1;
}
lcd.printf("%c", symbol);
}
}
Hi all,
Please forgive how basic this is, I'm aware the knowledge needed can be found in books etc but I can't grasp this on my own.
I'm trying to take input from a PS/2 keyboard (which works printing char's to an LCD just fine), and write each character into the array 'message', until it is full.
I've tried compiling the code below, but the ouput says a 'const char*' can't be written to an entity of type 'char'. Does anyone know why this is please? The main line of interest is line 20, with the note next to it.
Any help would be much appreciated. Thanks.
Simon
#include "mbed.h"
#include "PS2ASCII.h"
#include "TextLCD.h"
PS2ASCII myKeyboard(p9, p10);
TextLCD lcd(p24, p25, p26, p27, p28, p29, p30,20,4);
DigitalOut LED(LED1);
Serial mbed2(p13 ,p14);
char message[20];
int i;
int charcount;
int main()
{
while (1) {
char symbol = myKeyboard.getChar();
//insert something here to watch for a carriage return line feed
//insert something here to initialise write loop for the message array, to send over serial
//do this loop for however many characters charcount says
for (i=0; message[i]; i++) //move to the next progressive char of the message array
message[i]="%c", symbol; //*NOT SURE ON THIS LINE* write symbol to this char in the message array
//increase charcount by one
if(myKeyboard.E0flag() == true) { //is the make code one or two bytes long?
lcd.printf(" E0 ");
LED = 1;
}
lcd.printf("%c", symbol);
}
}