Lucky Resistor
Menu
  • Home
  • Learn
    • Learn C++
    • Product Photography for Electronics
      • Required Equipment and Software
    • Soldering for Show
  • Projects
  • Libraries
  • Applications
  • Shop
  • About
    • About Me
    • Contact
    • Subscribe
  •  
Menu

Category: Improve your Code

Event-Based Firmware Example

Posted on 2019-08-052019-08-05 by Lucky Resistor

If you read the previous articles about event-based firmware, modularisation and templates, you may wonder how to combine all these concepts in your firmware. I created a working firmware example, based on an event loop. In contrast to the minimal example code in my articles, this one contains everything you need to start a project….

Read more

Consistent Error Handling

Posted on 2019-08-01 by Lucky Resistor

Error handling in firmware is a difficult task. If you decide to ignore errors, the best you can expect is a deadlock, but you could also damage the hardware. When reviewing existing code, I often find boolean return values or a system of error codes. The problem with these systems is the lack of readability….

Read more

Use Enum with More Class!

Posted on 2019-07-292019-07-29 by Lucky Resistor

You may be familiar with enum values, but do you know about enum classes? This great feature was introduced with C++11 to solve several problems with the regular enum declaration. Now I will explain the enum class declaration and demonstrate its practical uses. Although the examples I provide are intended for the Arduino Uno, the…

Read more

C++ Templates for Embedded Code (Part 2)

Posted on 2019-07-272019-07-31 by Lucky Resistor

Templates are a powerful feature of the C++ language, but their syntax can be complex. Here I will continue with the second part of the article. Although the examples I provide are for the Arduino Uno and Adafruit Feather M0, the concepts will work with any platform and with all modern C++ compilers. Recap of…

Read more

Bit Manipulation using Templates

Posted on 2019-07-232019-07-27 by Lucky Resistor

Did you read my article about C++ templates for embedded code? You learned how to use function templates. This post adds a practical example to this topic. Bit Manipulation You may be familiar with bit manipulation code like this: For simplicity, you like to select single bits using its index number. This is a common…

Read more

C++ Templates for Embedded Code

Posted on 2019-07-202019-07-27 by Lucky Resistor

Templates are a powerful feature of the C++ language but their syntax can be complex. This causes some developers to not use them, while others are concerned that templates might cause bloat to the compiled code. I will explain how templates work and how you may use them in your code. Although the examples I…

Read more

Auto and Structured Binding

Posted on 2019-07-162019-07-25 by Lucky Resistor

This article is just a short follow-up article for “Write Less Code using the ‘auto’ Keyword”. Structured binding is something handy, introduced in C++17. Therefore, only the latest compiler will support it. If you are mainly write embedded code, you may skip this article, because it will take some years until C++17 support is available…

Read more

Guide to Modular Firmware

Posted on 2019-07-142020-09-09 by Lucky Resistor

This article is for embedded software developers with a solid working knowledge of C or C++, but who struggle with large and complex projects. If you learn to develop embedded code, e.g. using the Arduino IDE, you find plenty of small example programs. It is helpful to get things started quickly, but as soon as…

Read more

It’s Time to Use #pragma once

Posted on 2019-07-132019-07-25 by Lucky Resistor

In my opinion, preprocessor macros and the outdated #include mechanism are one of the worst parts of the C++ language. It is not just these things are causing a lot of problems, even more, it is very time consuming to find them. This article will focus on #pragma once. In the past, I already wrote…

Read more

Write Less Code using the “auto” Keyword

Posted on 2019-07-122019-07-24 by Lucky Resistor

The auto keyword was introduced with C++11. It reduces the amount of code you have to write, reduces repetitive code and the number of required changes. Sadly, many C++ developers are not aware of how useful this keyword is. Especially embedded code can gain a lot by its usage. In this article, I try to…

Read more
  • 1
  • 2
  • Next

Search this Site

Top Posts & Pages

  • Storage Boxes System for 3D Print
  • Build a 3D Printer Enclosure
  • Free Storage Boxes Set
  • Shop
  • Accessing the SD Card (2)
  • Projects
  • How and Why to use Namespaces
  • Fan Controller
  • Simple Box with Lid for 3D-Print
  • Plastic Cup Meltdown - Working with Epoxy

Follow on Twitter

Follow @LuckyResistor

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 97 other subscribers

Recent Posts

  • Decorative, Massive, Modular Box

  • Let’s Print a Cat/Pet Feeding Device (Part 6)

  • How to Create a Prototype Connector from a Pin Header

  • Flawless PCB by Eurocircuits

  • Input Panel – Request for Comments

  • Let’s Print a Cat/Pet Feeding Device (Part 5)

  • Let’s Print a Cat/Pet Feeding Device (Part 4)

  • Box in 500 Sizes with Smileys

Categories

  • Build (2)
  • Common (35)
  • Fun (6)
  • How and Why (10)
  • Improve your Code (17)
  • Learn (19)
  • Projects (79)
  • Recommendations (5)
  • Request for Comments (1)
  • Review (2)
  • Software (7)
Copyright (c)2020 by Lucky Resistor. All rights reserved.
Lucky Resistor
Privacy Policy / Proudly powered by WordPress Theme: FlatMagazinews.