Comment (Remark) your code
One of the things that you will recognise on this site is the heavy commenting (bordering on over commenting) on any code provided. This is not a new idea, in fact it has been around since coding began.
You might be of the opinion that no one will see your code, or your code is too basic to warrant commenting, or that it takes too much time.
You only need to look around the forums, and see the number of mistakes that people make, not just from simple typo’s, but porting their code to a new microcontroller platform or SBC (Single Board Computer), or moving from Python 2 to Python 3. Then also take a look in forums at the code examples that people have provided as answers (all for people helping each other), it all makes sense to everyone at the time of the post, but remember that remains on the internet for 10+ years or more, and someone comes across the code, and tries using it, only to become frustrated, as it was meant for a model 5 years before the one he has now, and probably in a version of the language that is no longer current. You can understand why that person ends up becoming frustrated, puts it away in the draw, never to be taken up again.
Start with the basics
The number of times you see people trying to run before they can walk. This is not to say, you can’t attempt a complex project, and if it works for you, that really is great. But when it fails, you need to go back to basics, by breaking down the project into parts and learning each part, how it works. Electronics (which incorporates Microcontrollers and SBC’s) is simply putting building blocks together, just like an adult version of LEGO®. This applies to the code as well as the hardware.
Take the time to understand how the component works, how to debug the component/software, how to test the component/software in an isolated environment. Learn how to use the test equipment you have access to, and what to expect from it.
Like solving a mystery or a crime, it comes down to what you know, and what you don’t know, to the point you narrow it down, and this can only be done by reaching factual, tested conclusions, and this can only be done by checking and testing and research.
Obtain the Manufacturers Data Sheets
When you have purchased a sensor or working with a device such as Stepper Motor, locate the manufacturers Data Sheet, and download it, keeping your own personal library of data sheets. These become invaluable as you work through your design, work through a documented project, or have to fault find something that was working before but not now. One of the critical things to remember is that, especially with sensors and devices, no one person’s setup is the same as another, and that goes for your environment as well as well as the quality of the parts.
Hexadecimal / Binary / Decimal Calculator
Find a calculator that you find you are comfortable with. One that can perform bitwise calculations as well. You can look for a standalone one or an app that runs on your computer or even your Android / IOS device. Windows 10 (and probably earlier) has one built in.
LEGO® is a trademark of the LEGO Group of companies which does not sponsor, authorize or endorse this site