Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 8 months ago.
Serial Port flow control
The compiler thinks the identifiers RTSCTS etc. are undefined in the following code but they are defined in "SerialBase.h" which is included. Advice ?? :
- include "mbed.h"
- include "SerialBase.h"
Serial pc(USBTX, USBRX);
int main() {
setup serial port pc.baud(115200); set baud rate pc.set_flow_control(RTSCTS,RTS,CTS);
while(1) { pc.putc(pc.getc()); wait for any character }
}
2 Answers
10 years, 8 months ago.
Insert <<code>> and <</code>>
tags around your code (each on its own separate line) to get proper formatted code on the wiki site.
Your problem can be fixed by using the Class name for the defined values. Use Serial::RTSCTS. The other parameters are pinnames and need a valid pin. Note however that you cant use this function on the original mbeds since the pins neeeded for rts and cts are not externally accessible.
10 years, 8 months ago.
NB the code didn't paste properly into my previous question - the hash-includes do start with a hash sign and not a number !