AVR Library Command Reference
Table Of Contents
- Pololu AVR Library Command Reference
- 1. Introduction
- 2. Timing and Delays
- Reference
- 3. Orangutan Analog-to-Digital Conversion
- Reference
- 4. Orangutan Buzzer: Beeps and Music
- Reference
- 5. Orangutan LCD
- Reference
- 6. Orangutan LEDs
- Reference
- 7. Orangutan Motor Control
- Reference
- 8. Orangutan Pushbuttons
- Reference
- 9. Orangutan Serial Port Communication
- Reference
- 10. Orangutan System Resources
- 11. QTR Reflectance Sensors
- Reference
- 12. 3pi Robot Functions
- 13. Wheel Encoders
- Reference
Reference
C++ methods are shown in red.
C functions are shown in green.
static void OrangutanSerial::setBaudRate(unsigned long baud)
unsigned char serial_set_baud_rate(unsigned long baud)
Sets the baud rate on the serial port. Standard values up to 115200 should work fine; for higher speeds, please
consult the AVR documentation.
static void OrangutanSerial::receive(char *buffer, unsigned char size)
void serial_receive(char *buffer, unsigned char size)
Sets up a buffer for background reception. This function returns immediately, but data arriving at the serial port
will be copied into this buffer until size bytes have been stored.
static char OrangutanSerial::receiveBlocking(char *buffer, unsigned char size, unsigned int timeout_ms)
char serial_receive_blocking(char *buffer, unsigned char size, unsigned int timeout_ms)
Receives data, not returning until the buffer is full or the timeout (specified in milliseconds) has expired. This
function is useful for simple programs and for situations in which you know exactly how many bytes to expect.
static void OrangutanSerial::receiveRing(char *buffer, unsigned char size)
void serial_receive_ring(char *)buffer, unsigned char size)
Sets up a ring buffer for background reception. This is a more advanced version of serial_receive that is useful
when you need to read in data continuously without pauses. When the buffer is filled, getReceivedBytes() will
reset to zero, and data will continue to be inserted at the beginning of the buffer.
static void OrangutanSerial::cancelReceive()
void serial_cancel_receive()
Stops background serial reception.
static inline unsigned char OrangutanSerial::getReceivedBytes()
unsigned char serial_get_received_bytes()
Gets the number of bytes that have been read into the buffer; this is also the index of the location at which the
next received byte will be added.
static inline char OrangutanSerial::receiveBufferFull()
char serial_receive_buffer_full()
Returns true when the receive buffer has been filled with received bytes, so that serial reception is halted. This
function should not be called when receiving data into a ring buffer.
static void OrangutanSerial::send(char *buffer, unsigned char size)
void serial_send(char *buffer, unsigned char size)
Sets up a buffer for background transmit. Data from this buffer will be transmitted until size bytes have been sent.
If send() is called before sendBufferEmpty() returns true (when transmission of the last byte has started), the old
buffer will be discarded and tramission will be cut short. This means that you should almost always wait until the
data has been sent before calling this function again. See sendBlocking(), below, for an easy way to do this.
static void OrangutanSerial::sendBlocking(char *buffer, unsigned char size)
void serial_send_blocking(char *buffer, unsigned char size)
Same as send(), but waits until transmission of the last byte has started. When this function returns, it is safe to
call send() or sendBlocking() again.
Pololu AVR Library Command Reference © 2001–2009 Pololu Corporation
9. Orangutan Serial Port Communication Page 23 of 35










