Fast string to integer conversion (C/C++)

This article presents a few fast and lightweight implementations of conversion from ASCII string to integer. It can be an interesting fit to use in a small microcontrollers like for example ATtiny13, which resources are very limited. All presented functions are simplified and require a null-terminated array of chars as an argument. Convert string to … Read more

Fast string comparison for microcontrollers (C/C++)

This short article presents trivial but fast and memory efficient function to compare two strings. Function returns “0” (zero) on success (strings are the same), otherwise function returns the position where different characters occurred. Example code #include <stdint.h> #include <assert.h> static int8_t xstrcmp(const char *s1, const char *s2) { while(*s1 != ‘\0’ && *s1 == … Read more

Arduino – LED logarithmic fade

Yet another Arduino LED fade effect. Similar to Arduino – LED linear fade. However, this one is using logarithmic scale for the delay time. It gives a nice “breathing” LED light effect. With properly adjusted settings it can look like a sleep LED effect in a macbook. This example Arduino project lights the basic LED connected in series with … Read more

Arduino – LED linear fade

This article explains how to make an example Arduino project that lights the basic LED (connected in series with resistor to pin 11) using linear fade effect. To build a nice fade effect you need to know how to change the LED brightness, first. The complete code is also on GitHub, here. Linear Fade effect changes the LED brightness … Read more

Arduino – basic LED blink

Yet another Arduino blinking LED example. This one is using BasicLed class to make the LED control more comfortable. The code is on Github, here. Parts Required arduino board (i.e. Arduino/Genuino UNO) basic LED (i.e. on-board LED) Software This code is written in C++ and can be compiled using an Arduino IDE. All information about how to compile this project is here. … Read more

Arduino – example of 28BYj-48 stepper motor controller

This article presents a simple example of how to control with Arduino a very cheap 28BYJ-48 stepper motor. The code is on GitHub, here. Parts Required ULN2003 driver stepper motor 28BYj-48 arduino board (i.e. Arduino/Genuino UNO) Software This code is written in C++ and can be compiled using an Arduino IDE. All information about how to compile this project is here. /** * Copyright (c) 2019, Łukasz … Read more

Arduino – blinky with Timer1 COMPA

Next Arduino blinky project. This version of “blinky” example is using Timer1 Compare Match A interrupt to make an onboard LED blink for roughly one second. The code is on Github, click here. Parts Required arduino board (i.e. Arduino/Genuino UNO) basic LED (on-board LED) Software This code is written in C++ and can be compiled using an Arduino IDE. All … Read more

Arduino – blinky with Timer1 OVF

Yet another Arduino blinky project. This version of “blinky” example is using Timer1 Overflow interrupt to make an onboard LED blink for roughly one second. The code is on Github, click here. Parts Required Arduino board (i.e. Arduino/Genuino UNO) Software This code is written in C++ and can be compiled using an Arduino IDE. All information about how to compile this project is here. /** … Read more

Arduino – blinky with delay function

This is another blinky project. A “Hello World” program for the electronics. This version of “blinky” example is using delay function to make an onboard LED blink for roughly one second. The code is on Github, click here. Parts Required Arduino board (i.e. Arduino/Genuino UNO) Software This code is written in C++ and can be compiled using an Arduino IDE. All … Read more