I recently engaged with a university robotics project (based on ROS) and my main processing controller is Raspberry Pi and the system stability controller is Atmega 32 microcontroller (It is responsible for driving motors and check the communication protocols ex:-i2c,rs232 are working in good manner). So the motor controller of this robot is a i2c type one and and it drives the motors according to the i2c signals that coming from the i2c port of the Atmega 32 microcontroller. The main controller communicate with the Atmega 32 using rs232 protocol. So I found an arduino code as below,
// This function is called once when the program starts.
void setup() {
// Choose a baud rate and configuration. 115200
// Default is 8-bit with No parity and 1 stop bit
Serial.begin(115200, SERIAL_8N1);
}
// This function will loop as quickly as possible, forever.
void loop() {
byte charIn;
if(Serial.available()){ // A byte has been received
charIn = Serial.read(); // Read the character in from the master microcontroller
Serial.write(charIn); // Send the character back to the master microcontroller
}
}
The communication between processing board and microcontroller as below diagram
There is an already available arduino library called rosserial for ROS. But I want this in AVR GCC.What I want is convert this code to traditional avr gcc code that work on atmel studio 6