Add dedicated scratch-space header so that we can track where these are still used

This commit is contained in:
Reed Nightingale 2020-04-21 21:08:51 -07:00
parent f113551aa6
commit f090a75221
1 changed files with 13 additions and 0 deletions

13
scratch_space.h Normal file
View File

@ -0,0 +1,13 @@
/**
* The Arduino, unlike C/C++ on a regular computer with gigabytes of RAM, has very little memory.
* We have to be very careful with variables that are declared inside the functions as they are
* created in a memory region called the stack. The stack has just a few bytes of space on the Arduino
* if you declare large strings inside functions, they can easily exceed the capacity of the stack
* and mess up your programs.
* We circumvent this by declaring a few global buffers as kitchen counters where we can
* slice and dice our strings. These strings are mostly used to control the display or handle
* the input and output from the USB port. We must keep a count of the bytes used while reading
* the serial port as we can easily run out of buffer space. This is done in the serial_in_count variable.
*/
extern char c[30], b[128];