Go Down

Topic: [Sharing experience] Organizing your code with ASCII art big fonts (Read 457 times) previous topic - next topic

liudr

I have written several post on how to optimize your code, specifically optimizing memory usage, and keep them in separate tabs to organize a longer project. This time it is a trick I do (didn't see anyone else I know do this yet). In Arduino, you can create block comments as the following:

/*

All is comment

blah….

*/

So besides using these block comments to document how to call a function you wrote or how to configure a library or else you can also do the following:

Code: [Select]
/*
.___  ___.  _______ .__   __.  __    __
|   \/   | |   ____||  \ |  | |  |  |  |
|  \  /  | |  |__   |   \|  | |  |  |  |
|  |\/|  | |   __|  |  . `  | |  |  |  |
|  |  |  | |  |____ |  |\   | |  `--'  |
|__|  |__| |_______||__| \__|  \______/
*/


Pretty cool, right? It clearly indicates the content after this comment has something to do with menu. If you scroll through your hundreds of lines of code, this will catch your eyes much easier than any comments. Although some programmers use a row of # or - to separate codes, this is better. you can have all of these elements together to improve the overall readability of your code:

Code: [Select]
/*
########################################
.___  ___.  _______ .__   __.  __    __
|   \/   | |   ____||  \ |  | |  |  |  |
|  \  /  | |  |__   |   \|  | |  |  |  |
|  |\/|  | |   __|  |  . `  | |  |  |  |
|  |  |  | |  |____ |  |\   | |  `--'  |
|__|  |__| |_______||__| \__|  \______/
########################################
Menu functions go here!
*/


Here is where I found this starwars font:

http://www.network-science.de/ascii/

Just scroll down the font list and find your favorite!

To read all my posts on coding, press the "coding" button on my blog.

Go Up