Tags:
create new tag
, view all tags
-- AlexandreProust - 2011-08-25

The beagleboard have two serials ports which can be used for communication. First the RS232 port used during the installation of Ubuntu and secondly four serial pins on the main expansion header. For the transmission you need this three codes

serial_config.h

and

serial_order.h

Serial port configuration

To open and configure a serial port to send bytes orders we will use the function serialconfig()+ of the file \verb+serial_config.h+ This function return an integer so it must be called like that at the beginning of the code:

//open and configure serial port 
int srl_handle = serialconfig(); 

This integer will be used later as parameters for the send orders function. The default configuration uses the serial port of the expansion header /dev/ttyO1 with the fastest speed, 115200 bauds. To use the serial ports RS232 the constante MODEMDEVICE must be changed by /dev/ttyO2. The USB port can be also used with the name /dev/ttyUSB0.

Send orders

The control of the e-bug is by serial ports. These orders are bytes packet. Several main commands have been written in the file serial_order.h.

  • go forward : goforward()
  • go on the right (left motor forward, right motor stop) : goright()
  • go on the left (right motor forward, left motor stop) : goleft()
  • rotation on the right (left motor forward, right motor backward) :
  • rotationright() rotation on the right (right motor forward, left motor backward) :
  • rotationleft() stop (two motor stop) : stop_order()
To give an order use these functions with as parameters the previous int srl_handle and the speed wanted. For example give the order to go forward can be write goforward(int srl_hangle, 11).
Topic revision: r1 - 2011-08-25 - AlexandreProust
 
This site is powered by the TWiki collaboration platformCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback