I am trying to get an LED connected to a serial port to light up. I have followed a step-by-step tutorial which can be found here. I have followed the directions exactly but cannot get the code to compile. From the PDF guide, it is part 2 which does not compile, which I reproduce here:
//<Set serial port parameters>
DCB dcbSerialParams = {0};
dcbSerial.DCBlength=sizeof(dcbSerialParams);
if (!GetCommState(hSerial, &dcbSerialParams))
{
//error getting state
}
dcbSerialParams.BaudRate=CBR_19200;
dcbSerialParams.ByteSize=8;
dcbSerialParams.StopBits=ONESTOPBIT;
dcbSerialParams.Parity=NOPARITY;
if(!SetCommState(hSerial, &dcbSerialParams))
{
//error setting serial port state
}
//</Set serial port parameters>
I have included in the code as specified, but I receive the error message “`dcbSerial’ undeclared (first use this function)”. I am using Dev-C++.
Essentially all I am trying to do is get a command which flashes the LED on and off, which I can put into another program I have (an eye tracking device – the idea is to get the LED to flash when your eyes are looking at it).
Any help very much appreciated.
Replace
dcbSerialwithdcbSerialParams.