Having churned out hundreds of Arduino based projects over the last 3 years, and being a less than organised person, I sometimes come across one of my little controller boards ( with a 328 chip and ISP header on ) in a module , and cannot remember which sketch I loaded it with .
When I saved sketches, I put remarks at the top to describe the project, but have only included the line:-
Serial.println("setup"); - to show something is happening-
which doesn't help identify the sketch or what the chip does if I commented out all the other SerialPrints in the sketch.
I might be missing something here , and you guys might have been doing this all the time , but now I put all my sketch descriptions in setup, so that I can plug in any chip and look at SerialMonitor and get the whole story.
Serial.println (" Harrys wall mounted display, using alphanumeric 5x7 pcbs from" );
Serial.println (" 5s footabll with MAX7219 chips");
Serial.println (" (2)(32)123456(3) format start of text, space, data, end of text.");
Serial.println ("saved as allprojects/softwareinproduction/Harrysfixeddisplays/allworkingwallunit.ino ");
Serial.println ("writes to eeprom when serial comes in, reads from eeprom each loop to save");
Serial.println ("garbled display if power glitch etc. ");
Serial.println ("using my new zero blanking routine, display up to 999999 - there modified one 199999");
Serial.println ("Auto dimming, but with long average time to reduce flicker as only 15 levels of brightness");
Incidentally I have finally moved over to v1 .ino sketches ( I didn't have a chance to copy the libraries over for the last year or more ! )
You could use the F macro to not use ram.
Doing this of course requires the serial support code which uses up memory which may be nearly used up in some applications.
You could use the F macro to not use ram.
Doing this of course requires the serial support code which uses up memory which may be nearly used up in some applications.
Maybe PROGMEM.h uses less?
I don't go near as far as Boffin but especially when working with others a startup print with program name and version is a must-have.
Edit: ROFL! A startup print won't happen without some kind of Serial! DOH!
I wonder if you could make a little macro or something that would blink an LED (pin 13 most likely) in a pattern for a number (ie - 3 blinks, pause, 2 blinks = "32") - then look that number up on a spreadsheet or something?
Have it do that constantly until another pin is brought LOW or something, then dump into the rest of the code. It would be smaller than needing the serial lib, you wouldn't need a serial port available (maybe you're in the field?) - and it would use less memory/flash.
You could use the F macro to not use ram.
Doing this of course requires the serial support code which uses up memory which may be nearly used up in some applications.
I wonder if a small function that hits the hardware serial directly to print out a simple char string so no need of Serial and all it's RAM use? This all assumes the program does not normally use Serial.
I don't remember if the Serial stuff can be optimized out if they're not used, but if so, a simplistic, hard-coded serial routine can be really tiny. RAM usage could be temporary, and little more than a couple bytes. Flash space would be a couple hundred bytes tops, most of that being the contents you want to transmit.
cr0sh:
I wonder if you could make a little macro or something that would blink an LED (pin 13 most likely) in a pattern for a number (ie - 3 blinks, pause, 2 blinks = "32") - then look that number up on a spreadsheet or something?
Have it do that constantly until another pin is brought LOW or something, then dump into the rest of the code. It would be smaller than needing the serial lib, you wouldn't need a serial port available (maybe you're in the field?) - and it would use less memory/flash.
PC/XT's used to beep and you might have to look that number up.
Thinking about the memory savings, I have simply included the path and sketch name in the serial print, and then have the comments at the top again commented out.
Thanks guys.
The data can be kept totally in flash and print from there using the F( ) macro.
Flash is where your program lives, it's what you download sketches into.
Flash also holds constant data like strings (messages, prompts) and lookup tables.
An UNO chip ( ATmega328P ) has 32K of flash and 2K of RAM. Saving RAM is paramount while saving flash only matters when you really push program and data limits, not a usual practice.
If your 10 lines have useful data then stick them in there. Version, Usage, Errors, use them all.