New trick I just learned for note taking in Arduino IDE

Started by syrinxtech, December 13, 2015, 10:57:59 AM

syrinxtech

I'm sure you "old timers" out there already know this one, but I just discovered it and thought I would pass it along.  I find when I'm writing code off the top of my head, which is most times, I often think of things to remember to do later, or find a code snippet I want to include.  Most times I write them in my notebook but sometimes I find, especially with code snagged electronically, it's easier to store it with the code.

This morning I was adding an RTC to my home Moteino GW project and since I didn't have the physical h/w in front of me I was just updating the code.  I grabbed the specifics of the fields returned by the RTC and instead of writing them down or opening Notepad, I added a new tab on my Arduino IDE sketch.  I then copied all of the code I wanted to add later.  I just called it "Notes".  When I tried to compile the code it complained and I just added the normal "/*" and "*/" comments around the chunk of code and everything is good.


Felix

Good tip,
But FYI the new file will have a .ino extension on disk. So it's considered a code file. But of course you can just name it "NOTES/README" and it will open next to the actual sketch.

syrinxtech

I named it just "Notes".  It did create an INO file but since I put comments around the whole contents of the tab it doesn't actually get compiled.

Thanks for the tip....didn't think about the disk file.

oric_dan

BTW, it's much easier to envelop your unfinished/untested/unused/obsolete code as follows, then you can use all the standard commenting, /*...*/ and //, without needing to do anything extra.

#if false
.... notes or code here ....
#endif

I normally use
/*
......
*******************************/
at the head of files for notes, and the #if business for code.

Nuudeli

Another tip: There's also 'Use external editor' tick in the IDE settings which enables to use external editor. Arduino IDE then only compiles and uploads the latest code when needed. I found Notepad++ superior compared to Arduino IDE editor.