# Saving into internal memory

**URL:** <https://discourse.processing.org/t/saving-into-internal-memory/7611>\
**Category:** Electronics (Arduino, etc.)\
**Created:** [January 18, 2019, 4:31am UTC](https://discourse.processing.org/t/saving-into-internal-memory/7611 "2019-01-18T04:31:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ArduinoKer](https://avatars.discourse-cdn.com/v4/letter/a/e36b37/32.png) [@ArduinoKer](https://discourse.processing.org/u/ArduinoKer)\
**Post date:** [January 18, 2019, 4:31am UTC](https://discourse.processing.org/t/saving-into-internal-memory/7611/1 "2019-01-18T04:31:51Z")

</div>

Hello everyone, i have a coding question… I am currently doing a project about positioning. I am using the Processing application to display the movements and the coordinates of my device, also i’ve added some extra features ( creating a flight path ) As you can see below…

![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/8/8e7cc541d782ba64cfe0e744e16d8fde5225839d.png)

But now i am thinking is it possible to store the information when an external trigger is being input-ed by the user in the serial monitor.

```auto
 char rx_byte = 0;
  int z;
  coordinates_t coor;
int a = coor.x;
int b = coor.y;
int c = coor.z;
const coordinates_t SavedCoordinates[] PROGMEM = {};

   if (Serial.available() > 0) { // is a character available?
    rx_byte = Serial.read(); // get the character
  
    if ((rx_byte == '1')) {
      Serial.print(" START RECORDING \n");
    const coordinates_t SavedCoordinates[] PROGMEM = {};
    
    }
    else if (rx_byte == '2'){
      Serial.println(" STOP RECORDING ");
    }
    else 
    {
      Serial.println(" Invalid Input ");
    }  
}

```

coor.x, coor.y and coor.z is the variables that hold my coordinates value… I was thinking when the user input a ’ 1’ into the serial monitor the " START RECORDING " words will be printed in the serial monitor and wherever i move my device, ALL the coordinates will be stored inside the memory of the board ( it can be any memory, it can be flash,SRAM, EEPROM ) until a ‘2’ is input-ed and the " STOP RECORDING " is printed. Meaning all the coordinates data in between the start and stop recording is to be saved in the internal memory… Any one knows if it is possible.? please help me … Thank you very much

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [January 18, 2019, 12:01pm UTC](https://discourse.processing.org/t/saving-into-internal-memory/7611/2 "2019-01-18T12:01:13Z")

</div>

i think:

- that is a pure arduino question  
( using arduino IDE monitor and a USB connected arduino with some ?GPS? hardware )

- so it is a little bit misplaced at the processing forum  
while a combination of processing and arduino code ( as a complete project is welcome )

- using arduino local memory

- 
  - progmem ( flash ) ( your example )

- 
  - RAM like in a normal array ( lost at reboot )

- 
  - EEPROM not so easy but good as data are not lost

- 
  - there are some HAT’s with uSD card slot or more eeprom…

- to collect data and send them later is usual practice  
( like a oscilloscope reading analog / writing serial port would do ?400Hz?  
a reading batch to array ( i do 360 samples as fast as possible )  
and sending the batch to processing after that, get me up to 8kHz (batch) sampling rate one channel only

what i worry is that you have a concept in mind like

- send a “start”
- shutdown or disconnect processing computer
- let it sample for a certain time
- connect again and read out the data

so i have to warn you that

- shutdown ( i never see that anywhere mentioned )

AND

- connect

serial interface will reboot the arduino!  
means your arduino sample logic ( and data ) must survive 2 reboots!
