I’ve purchased a couple Arduino Starter Kits, and have completed the first 10 projects, taking time to study the code and trying to understand the theory behind some of the processes. Truthfully, I don’t think I could ad lib based on what has stuck with me. What I mean is I’m not able to write my own code for a working sketch without the tutorial. Also, I’ve reread how the 74HC595 Shift Register functions but… am I too old or will things pop for me as I go along? I know you aren’t able to count how many neurons I still have firing but between new terminology, code, and just recognizing one part vs another the rest is just magic.
You can't be expected to remember everything. Maybe if you do it 10 hours a day for years. No shame in starting with an example or snippets of code and modifying it to meet your needs. I never start with a blank page.
I have collected over the years compilable function sketches I refer to as modules or building blocks. I root through them to find the function I want to include.
On Edit: I reference this page a lot. I mean A LOT, like all the time. I can't remember all this
If you try to learn a new spoken language, you can not expect that you can speak smooth after a few days. It's hard work, and you have to use the language. Tutorials and schooling are important, but if you don't use this knowledge in your practice it will have no effect.
Basically, I recommend to looking for a few schoolings on Udemy or similiar online platforms. I also recommend learning modern c++ to understand how to learn clean programming. You will also learn the limits of the gcc compiler and the limits of the C language.
It's a big relief to read your response. Thank you! The tutorial states pay attention to the coding, and I do, but when it changes in the next module and explains why, it is not like I have a framework upon which to build an understanding. I kind of figured Id be building my knowledg of code over time. My real worry was in not really comprehending how the Shift Register functioned fully. I understand it somewhat but not completely. So, thanks, I wont give up yet!
-
Many here are well into the 70s, lots of volunteers giving guidance.
-
Assume you aren’t in a hurry and looking at this as a hobby.
Suggestions of things you need to master
- Always start a project with a circuit schematic showing all the components and their interconnections.
- Code “must” be written in a non blocking fashion.
- To keep code organized and easy to follow, the State Machine technique needs to be adhered to.
- Using HIGH or LOW does not explain what is happening, use names like: LEDon, RELAYon, ENABLED, CLOSED etc.
- Avoid magic numbers. Use names that describe the value. Instead of: 60ul * 1000, use sixtySecInterval.
- Let the compiler do the math for you, for 15 minutes, instead of 900000 use 15ul * 60 * 1000
- Keep version backups so you can always go back to the last working version.
- Do not use delay(…) as it will stop code execution during this delay interval.
- Use non blocking TIMERs based on the millis() or micros() functions.
- Write your code in a neat easy to read style, use white space, add meaningful comments throughout.
- Use the Arduino onboard LED on pin 13 as a heartbeat LED to show code is running and code is not stuttering.
- For mechanical switches avoid looking at digital input levels, instead, look at digital input “changes in state”.
- Place braces, { and }, on separate lines so they don’t get lost in the other text.
- Use one code statement per line.
- LEDs displaying the current state in a State Machine, can be used to diagnose problems.
- For diagnosing problems, use serial monitor print statements to confirm variables are what you think they are.
- Write only small blocks of code at a time. Prove the new code block works 100% before proceeding.
- The way you learn how to write software is by writing software.
I'll keep at it, then. Its not just the theory, it's searching forum topics, finding where to post; I read when replying I should activate the blue bot but I dont see it... takes hours and hours
Well that's good to know! Good references!
Hello crabcrawler
Write your own recipe to brew new Arduino projects.
Use this text template and improve it project by project.
You could start with this sketch layout:
//
//https://europe1.discourse-cdn.com/arduino/original/4X/7/e/0/7e0ee1e51f1df32e30893550c85f0dd33244fb0e.jpeg
#define ProjectName "ProjectName"
#define NotesOnRelease "Arduino DUE NANO UNO MEGA tested"
// make names
// make includes
// make objects
// make variables
// make support
void heartBeat(const uint8_t LedPin, uint32_t currentMillis)
{
static bool setUp = false;
if (setUp == false) pinMode (LedPin, OUTPUT), setUp = true;
digitalWrite(LedPin, (currentMillis / 500) % 2);
}
// make application
void setup()
{
Serial.begin(115200);
Serial.print("Source: "), Serial.println(__FILE__);
Serial.print(ProjectName), Serial.print(" - "), Serial.println(NotesOnRelease);
Serial.println("\n\n =-> and off we go\n");
}
void loop()
{
uint32_t currentMillis = millis();
heartBeat(LED_BUILTIN, currentMillis);
}
Have a nice day and enjoy coding in C++.
I rarely write code without reference manuals and/or examples and/or tutorials open in other windows. Especially in less familiar languages. And I've been programming for about 40 years now. (at some point, your project becomes big enough that the code you've already written becomes your "example", I guess.)
Stay with it as long as you're enjoying it and you recognize a benefit in doing so. The benefits can be measured in many ways. Challenging yourself, stimulating your mind, satisfaction in creating something, filling idle time. Excessive stress is not good for mind or body. Don't allow this to stress you.
This is good advice! I retired Jan. '22, and transitioning is somewhat challenging. My brother, retired for many years, keeps telling me to relax more. In pursuing this, for all the reasons you stated, I increasingly found myself feeling under pressure- just like at work or feeling as if my physics exam is coming up and I'm far from passing it, much less getting the "A". I don't want to pursue a new career or learn a new trade, I've had plenty. In the short time I've been doing this, I have learned some neat stuff , useful already in my other interests away from the mind melting television.
I try for learning something everyday. Even if it turns out to be something I learned already and forgot.
I recommend reading on these fora. Read a thread until you know it is of zero interest subject-wise, but even if it seems like you don't care, like automatic chicken coop doors or something.
Read a thread until you know it is already stuff you've come across and feel OK about, or is obvsly sailing confidently over your head and you feel bewildered.
I see both those kinds of posts.
For the happy threads you pay attention to, read read read the code. No good writer of anything is not also widely read. You'll see things if you study the code on a line-by-line basis, stop ask questions google to determine what every single line is contributing.
Something that you'd like to try for yourself, you can usually start with example code that should work without modification if you were playing with, for example, an RTC real time clock module to see about making yourself an expensive (time is money, and no one is getting younger!) alarm clock.
Nothing motivates learning like wanting to actually make something work.
Reading here is also the way to see what can, and cannot, be done with these little boards, and the various issues that come up that aren't strictly software or programming problems.
a7
Now where did I put the reference file and what was the URL that describes how to do this ?
Oops. I left out people. One of the things I miss most, being retired, is being surrounded by many other people with ideas and expertise in areas that I have paid less attention to. Various online fora are somewhat similar, but ... not the same. (not that everyone is lucky enough to work somewhere with that much expertise floating around, but ... it was nice.)
I value referencing, highly. Knowledge is "old" the moment it is "known."
In fact, technical ISO changed their reference material from printed to web-based, with footers or headers reading, [paraphrased] "DO NOT PRINT" because the moment the printout landed on the floor, it would be old, as "new standards" would be added at any time. No more "A" paging. No more microfiche purge.
After a life of high-tech, I find myself tinkering with small projects (after cleaning leaf gutters and pulling weeds). I can do this new hobby in any weather, day and night, with a footprint small enough to fit on a shelf, or tinker on a laptop with a project or web-based simulations. No pressure to finish.
I could start with Void Setup ()... if we alway void it why have it in the first place ?

if we alway void it why have it in the first place
Setup is a function that requires declaring its return type just as any other function. All functions have to have a return type declaration. The void states it doesn't return anything.
The Arduino IDE makes the setup and loop functions special in the fact that they are required. They can be empty, however they have to be present in the sketch.
Use the Reference link I provided in Post #2 to see what it says about void. Use that reference link
There's a lot of good talking points for a beginner like me in this post. I've screen captured the suggestions of things to master, and printed a cropped version to add to my file. Is there an easier way for printing posts/threads without the rest of the page layout that you know of? Are you the author of this? Thanks
I wasn't able to digest all that I was seeing and hearing on this forum. I've actually found some time to dedicate to Arduino, and have been rereading my discussions. You have alot of good links here. I'm looking at the Programming course and it looks I should start there. Nice help!
After reading your reply, I headed to the local office supply, bought a binder, printed out my Elegoo lessons, printed out various posts and materials from youse guys, and started my file. It's getting pretty hefty already!