It's pretty quiet just now so I thought about dealing with this, perhaps once and for all. There are guides at the beginning of the forum, specifically:

Using millis() for timing. A beginners guide Useful links - check here for reference posts / tutorials How to use this forum - please read. Read this before posting a programming question ...

Read these, please, especially the last two.

I draw your attention to the ongoing plea to post your code in tags. There's a reason for this. Like many, I use a variety of tools in coding. One of these is Notepad++. It's a useful editor with very good colour highlighting that reveals many syntax errors immediately.

When code is formatted and posted properly (within tags) it is a very simple matter to select/copy/paste into a new tab in NPP (Notepad++). Selecting the language as C or C++ will highlight all the code in a keyword colour scheme of your choice. This makes life easier for somebody likely to offer you a suggestion as to what your software issue might be, rather than download, drag a mouse to select, reformatting, and on and on.

Furthermore, the user community for NPP is quite extensive as well and several plug-ins have been developed that make life easier still. If you choose to use NPP, make sure you get the plug-ins NPPExec and TextFX. The former allows for attaching command line batch-type structures to shortcut key sequences, thereby allowing you to invoke the avr-gcc compiler (or any other compiler for that matter) and the latter contains many text formatting functions, specifically Reindent C++ code.

Back to NPPExec, without having an Arduino even attached to your system you can compile your code quickly and see where errors and warnings pop up. As you have more direct control over the compiler switches, you can experiment more easily as well. Additionally, include objcopy in your batch file and you can produce a hex file that can be uploaded directly with avrdude or 3rd party apps such as Xloader. Switch compilers too! The latest release of Arduino IDE 1.8.5 ships with gcc 4.9.2 where the latest gcc release is 7.2.0. Using the latest compiler, I see code as much as 10% lighter.

All that aside, the point is that with an environment set up to quickly and easily load and check code, if that code adheres to the guidelines, is it any wonder really, why some get frustrated with what seems to be an ongoing ambivalence towards those requests? Remember, we're not reading your post for our benefit.

========================================= Post script.

For those interested in the NPP platform as an editor. Install at least the NPPExec plug-in. From the Plugins>NPPExec>Execute... (or press F6) you'll get a window for your script. What I use is:

NPP_SAVE cd $(CURRENT_DIRECTORY) d:\Arduino\AVR Programming\avr-gcc-7.2.0-x86-mingw\bin\avr-gcc.exe -Wall -mmcu=atmega328p -DF_CPU=16000000UL -std=c99 -Os -ffunction-sections -fdata-sections -MMD -flto -fno-fat-lto-objects $(FILE_NAME) -o $(NAME_PART).o d:\Arduino\AVR Programming\avr-gcc-7.2.0-x86-mingw\bin\avr-objcopy -O ihex $(NAME_PART).o $(NAME_PART).hex d:\Arduino\AVR Programming\avr-gcc-7.2.0-x86-mingw\bin\avr-size $(NAME_PART).hex

which will save the file, compile it, produce the hex file and then run avr-size so you can see how big it is.

Obviously the directory will need to be changed to point to your own compiler location and make sure that -mmcu is defining the proper processor. The other thing you must be aware of is that gcc ships with both the C and C++ compilers (gcc and g++). The file from within NPP must have a .c or .cpp extension (no .ino).


May I suggest you include links to things that you refer to. Apart from anything else they add a bit of colour.



The plug-ins can be loaded through the plug-in manager or NPPExec plug-in

TextFX plug-in

Latest release of avr-gcc 7.3.0 now avr-gcc

Stay on top of things.

DKWatson: Stay on top of things.

Good effort to try to help but This post will eventually sink into oblivion...

Fortunately on this forum there are so many willing to help out, answers outnumber the questions by multiples.

We do what we can.

FYI There is this thread regarding notepad++

And don't forget, not every computer in the universe runs [gag] MS Windows [/gag]..

Ya but Linux already gives you useful tools, Windows doesn't. And that other one???

Good point, when [gag] MS [/gag] dropped support for XP, I dropped [gag] MS [/gag] for Linux, I use "Kate".

Thanks larryd. I just threw a copy up on that thread.

I use the Geany editor.

And I have written a simple Python program to compile and upload using the command-line IDE.


Cool. Share?

DKWatson: Cool. Share?

To whom is that addressed?


To youm.

Let's keep this puppy on page 1 for a couple more days.