Go Down

Topic: reinventing the wheel again (Read 3924 times) previous topic - next topic

John_Smith

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.

Code: [Select]
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 ! )


45 years of editing projects with a knife and soldering iron, then I found Arduino !

robtillaart

Very recognizable, not doing it for all my sketches but yes, learned it the hard way;)

So I use in my sketches (if they are more than an experiment) - a title and optional a version number -
And also in my source code I use this header

//
//    FILE: .ino
//  AUTHOR:
// VERSION: 0.1.00
// PURPOSE:
//    DATE:
//     URL:
//
// Released to the public domain
//
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

John_Smith

Can you read that from the source code if you just have the chip ?
45 years of editing projects with a knife and soldering iron, then I found Arduino !

Henry_Best

Can you read that from the source code if you just have the chip ?
No, because comments aren't compiled and never get as far as the chip.

larryd

Nice.

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.

No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

weedpharma

Runs once at power up, takes no time and totally brilliant!

I will certainly be trying this when I get more than one Arduino project.

Having moved on from Picaxe and having numerous chips lying around, it is a good way to ID the program.

Weedpharma

GoForSmoke

#6
Nov 11, 2014, 09:04 am Last Edit: Nov 11, 2014, 09:05 am by GoForSmoke
Nice.

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!
1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.

keeper63

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.
I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

GoForSmoke

Shave and a haircut? (the secret knock)
1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.

Riva

Nice.

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.
Don't PM me for help as I will ignore it.

GoForSmoke

#10
Nov 12, 2014, 12:42 pm Last Edit: Nov 12, 2014, 12:45 pm by GoForSmoke
It's more about the RAM that char arrays, dialogs, prompts and labels.
If you're not going to run Serial then you might be needing much of those.

However if you do then use PROGMEM to keep constants in flash, not copied straight to RAM.

BTW, PROGMEM is a library in your IDE.

1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.

SirNickity

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.

larryd

#12
Nov 14, 2014, 03:15 am Last Edit: Nov 14, 2014, 03:16 am by LarryD
A sticker with a Rev number on it works also  ;)
No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

Henry_Best

A sticker with a Rev number on it works also  ;)
More permanent is a coat of typist's correcting fluid over part of the top of the chip. Write on it with a pen when dry.

GoForSmoke

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.
1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.

Go Up