code_junkie

Boost Asio serial_port - need help with io

Nov 12th, 2011
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include <boost/asio/serial_port.hpp>
  2. using namespace::boost::asio;
  3.  
  4. int main()
  5. {
  6. io_service io;
  7. serial_port port( io, "COM3" );
  8. port.set_option( serial_port_base::baud_rate( 19200 ) );
  9.  
  10. unsigned char commands[4] = { 1, 128, 240, 0 };
  11.  
  12. // write the commands to the device
  13.  
  14. return 0;
  15. }
  16.  
  17. boost::asio::write(port, boost::asio::buffer(commands, 4));
Add Comment
Please, Sign In to add comment