Pololu Robotics & Electronics
My account Comments or questions? About Pololu Contact Ordering information Distributors

HOW serial_send_blocking WORKS?


HI , i would like to know how this works, im trying to send a variable but i only can send one byte the max number
that this permit me send is 255, this is my code i will be grateful if u can help me, thanks.

	long dor = 270;
	long message[1];
	serial_send_blocking((long *)message, 2);



The serial_send_blocking function of the OrangutanSerial class takes a char pointer for its first argument, not a long pointer. For more details about that function, see the “Orangutan Serial Port Communication” section in the Pololu AVR Library Command Reference guide. You will need to send multiple bytes to represent your long variable. The variable is already being represented as four bytes in the AVR’s memory, so you can do something like this to simply send all of those bytes on the serial port:

serial_send_blocking((char *)&dor, sizeof(long));

By the way, what board are you using?

- Amanda