Saving and reporting later

Guys and girls.

I’m very much a newcomer to arduino and these forums, so please bear with me if I’m repeating something that has appeared before - I’ve tried searcing but no luck.

Is it possible to get the arduino to be running a program that gathers a small amount of sensor data and then later upon request sends that data over serial to a computer?

For example, I have 3 push buttons as inputs, I want to record the order of say the last 10 button presses. I then want to be able to go back to the computer, and be able to send the order to a terminal program to be saved.

Will the process of pluging the board in in any way stop the running program?

Would the best way to trigger the ‘download’ be to have a fourth button, which when pushed casues a string to be transmitted serially?

Thanks for any help,

Alex

hi alex,

the search on this forum doesn’t seem to work reliably. google usually does a better job if you use the term “arduino”.

plugging arduino in to your computer willl reset the board and thus all data inside the ram will be lost.

but you can write data to the eeprom on the atmega8 on your board.
start here: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1148480666/3

then you can have the main loop wait for you “send data” command coming over the serial line (usb) and read what you’ve stored.

whish you much fun,
kuk

Hmm… very interesting, thank you for the reply…

So the best way would be for the Arduino to listen to the serial port for a dowload command, then reply with it’s data saved in EEPROM.

What is the best way to have the arduino handle the two tasks of

[1] listening for and recording data
[2] listening for download command.

Is there some way of saying

if (arduino = plugged into computer)
download data
else
listen for button push
record data
end

Thanks for you help, tell me to go try it myself if you want though!

Alex

i don’t think that there is another way of telling whether your board is connected to the computer than wait for the command.

so:

if ( received_serial_string == “myDownloadcommand” ){
send the stored date
// maybe even clear the eeprom ?
}else{
read buttons
write values
}

should work.

best,
kuk

Awesome - thanks for your help, now to try it out!

Alex