Here is the code I currently have.
#include "mbed.h"
#include "TextLCD.h"
//Serial port pin assignment and setup
Serial device(p27, p28); // tx, rx
unsigned char tmp_data[16];
unsigned char rcvbuf[120];
int UART_data_ready;
int timer_1mS_ready;
int n;
int tmp;
int i;
int RPM;
int PW1;
int DutyCycle;
int CLT;
//LCD 2x20 parallel code pin assignment
TextLCD lcd(p21, p22, p23, p24, p25, p26, p30, 20, 2); // (rs, rw, e, d0, d1, d2, d3, n_column, n_rows)
int column;
int row;
int main()
{
device.baud(115200);
while (1) {
device.putc(97);
wait(0.005);
device.putc(0);
wait(0.005);
device.putc(6);
UART_data_ready = 1;
n = 0;
//********************
wait(0.005);
if (UART_data_ready == 0) { {
//********************************
//get Afr
tmp = rcvbuf[29];
//send text
lcd.locate(0,0);
lcd.printf("AFR=");
//send data
lcd.printf("%.3f" ,rcvbuf[29]);
}
} else {
lcd.locate(0,0);
lcd.printf("connection error");
}
}
}
I have a question regarding the serial commands. I need to send a three character command "a,0,6" as a polling call to my serial port. This command will return a string of 112 bytes that I will write to a buffer. The compiler does not recognize the "putc" command. It gives the error "too few argumements in function call". I should be able to send a single character in hex, decimal or character. Any ideas on how to fix this? Here is my code snippet.