Storing value into Orangutan X2 memory

Hello,

I work on a robot that avoid obstacles and uses Orangutan X2.
I would like to save two of my float variables (the position x and y) into the memory of the micro-controller every seconds and be able afterward to read these values in order to make a graph on Excel. Should I use the EEPROM ? How can I write my values ? Is it possible to read them directly using AVR Studio ?

If you need more precision i’ll be glad to give them to you.
Thank you for your help

Hello Boundal,

I wrote my data to RAM and then dumped the contents to the serial USB connection which I then captured using putty (terminal program). I took the output from putty and pasted it into an Excel spreadsheet.

When it was time to dump the contents, I printed a message on the LCD to prompt me to connect the USB and then waited for a button press before sending to the USB serial.

// val1[] and val2[] hold up to max_log_items values
					clear();
					print("Mid Button Dump");
					wait_for_button_press(MIDDLE_BUTTON);
					clear();
					print("Dumping...");
					char send_buffer[200];
					int idx;
					for (idx = 0; idx < max_log_items; idx++)
					{
						sprintf(send_buffer, "val1:%d val2:%d\r\n", val1[idx], val2[idx]);
						serial_send_blocking(USB_COMM, send_buffer, strlen(send_buffer));
					}
					clear();
					print("Dump Done");
					delay_ms(2000);

Hope this helps,
Mike

Thank you Mike. This is exactly what i was looking for.
I would like to know where I can find the serial_send_blocking() function. Is it in some .h file ? What is the USB_COMM value on a Orangutan X2?

Simon

Hi Simon,

The function is described in the Pololu AVR Library Command Reference:
pololu.com/docs/0J18

And the Pololu AVR C/C++ Library User’s Guide:
pololu.com/docs/0J20

Not sure which Orangutan X2 you are using but if you click on the resource tab you will find a great deal of information. For example here is the information supplied for the Orangutan X2 with VNH3:
pololu.com/catalog/product/716/resources

Take sometime and read the documents,

Mike

Thanks a lot for all these information.
I tried to implement it but run into a lot of conflict since I already use the timers in my project and these same timers are defined somewhere else in the Pololu lib. Since it is a .a file it is not easy to modify it.
That a shame since your solution would have work perfectly

Hello.

The source code for the library is included with the download. You should be able to just copy the parts you want into your own program.

- Ben