Baby O and PING

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

Hello, Cliff.

Thanks for providing the details of how you set your system up. On the Baby Orangutan, PD1 is TX so you will need to connect that to the RX of the programmer. PD0 is RX so that should be connected to the programmer’s TX, if you need to send data to the Baby Orangutan. You can confirm this by looking at the ATmega328P datasheet or the pin assignment tables from the Baby Orangutan B User’s Guide.

The warning you saw for serial_send_blocking only applies to the Orangutan SVP, which is a different model from the Baby Orangutan. I would recommend that you continue to use serial_send_blocking.

–David