So I am trying to set up serial communication between my baby orangutan and my pc via a putty terminal. In the future my hope is to output the states of variables as they update while the code is running to help in debugging but for now I figured the code David had posted would be the simplest way to start. Since I will only be using it to receive integer values from the baby O and not sending any data.
I have written this in C as follows.
#include <pololu/orangutan>
#include <stdio.h>
///////////////////////////////////
///////// Global Variables////////
//////////////////////////////////
int a = 1, b = 44;
// send_buffer: A buffer for sending bytes on PD1/TXD.
char send_buffer[80];
///////////////////////////////////////
///////// FUNCTION DEFINITIONS////////
//////////////////////////////////////
void setup()
{
serial_set_baud_rate(9600);
}
void loop()
{
serial_send(send_buffer, sprintf(send_buffer, "a=%d b=%d\r\n", a, b));
delay_ms(1000);
}
///////////////////////////////////////
////////////START OF MAIN/////////////
//////////////////////////////////////
int main()
{
setup();
while(1)
{
green_led(1); // changing PD7 state to flash an LED
delay_ms(500); // Wait for 200 ms.
green_led(0); // PD7 off
delay_ms(500); // Wait for 200 ms.
loop();
}
}// end of main
My avr programmer is running firmware version 1.07, ISP Freq. 1500 kHz, and Line A and B Identity= None. I do not believe I should be changing line A;B to have an identity for handshaking lines since I am only sending data and the PC should be ready to receive at all times.
The baby O is sharing a common ground with the AVR programmer, RX connected to PD0, and TX is connected with PD1, and the baby O is being powered at 5 volts by a DC power supply.
I changed serial_send_blocking() to serial_send() after reading the warning in the Pololu AVR Library Command Reference.
Putty appears to be connecting to the COM port fine, the baud rates are matched up at 9600. The terminal is just giving me a blank screen while the program is running.
Thanks for the help,
Cliff R