Adding Baud Rate [closed]

asked 2016-05-05 07:27:56 -0500

SQ gravatar image

updated 2016-05-05 07:53:24 -0500

Hi again. I'm sending commands and receiving feedback data using my Arduino Micro over the serial. I wanted to increase my baud rate from 115200 to 250000 as i realised that my feedback data is updating at a very slow rate. I came across this section of code:

switch( baud ) 
    case 115200:
            tBaud = B115200;
    case 38400:
            tBaud = B38400;
    case 19200:
            tBaud = B19200;
    case 9600:
            tBaud = B9600;
    case 4800:
            tBaud = B4800;
    case 2400:
            tBaud = B2400;
    case 1800:
            tBaud = B1800;
    case 1200:
            tBaud = B1200;
            tBaud = B19200;

I tried adding a case for 250000 and assigned B250000 to my tBaud but got a compile-time error. How do i add a 250000 baud rate? Thanks!

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by SQ
close date 2016-05-16 08:55:33.380885


It would be helpful to have a bit more context... what ROS package are you using? Where did this piece of code come from? What was the compilation error?

jarvisschultz gravatar image jarvisschultz  ( 2016-05-05 08:51:05 -0500 )edit

Sorry this is a custom package made by my project supervisor. I just wanted to know if this code has something that is common and if i'm able to add a higher baud rate. I tried initializing my baud rate on ROS and Arduino both at 250000 but it didn't solve the problem. Is 115200 the highest allowed?

SQ gravatar image SQ  ( 2016-05-05 09:19:39 -0500 )edit

A quick Google shows that many people do serial communication with Arduinos at higher baudrates, so that hopefully isn't too much of a road block. I'm still guessing that people won't have much to offer without more details on what you're trying to do, and how you are trying to do it.

jarvisschultz gravatar image jarvisschultz  ( 2016-05-05 19:15:31 -0500 )edit

I seemed to have solved the issue by other means. Apparently the problem lies with my no. of bits at the serial node not matching those of the Arduino and not the bit rate. Thanks anyway!

SQ gravatar image SQ  ( 2016-05-16 08:54:57 -0500 )edit