Programming Index
October 8, 2019

Push Button and LED on a Single GPIO Pin

When a microcontroler project needs more input and output pins than the available number, it is always interesting to use a single pin for more than one purpose. I show in this post how to use a single GPIO pin as an output to control a light-emitting diode and as an input to read the state of a normally open push button switch. [...more]

September 25, 2019

An ESP8266 Based Router Watchdog

After a considerable delay, I have finally begun to improve the router monitor built around a Sonoff Wi-Fi switch that I mentioned back in April 2018. Among the improvements, I have added manual override of the monitoring function and MQTT functionality which makes it possible to remotely control the router monitor through an MQTT broker [...more]

Update May 28, 2019. First version: May 18, 2019

Tide Data in Canada with Python

Here is a short note showing that it is possible to access tide data in Canada made available on the Web by the Canadian Hydrographic Service using a Python script. It's just a debut [...more]

February 28, 2019

Emulated IR Remote Control

or How to Use a $ 1,000 Desktop Computer to Emulate a $ 5 Infrared Remote Control. The note introduces a Free Pascal/Lazarus program that emulates a very old IR remote control that will soon be totally unusable [...more]

October 30, 2018

Install Free Pascal and Lazarus on Linux with FPCUPdeluxe

This is a rewrite of the August 17, 2018 post named Installing Free Pascal and Lazarus with fpcupdeluxe on Ubuntu 18.04. I followed the instructions in that initial post but the Free Pascal compiler and Lazarus IDE would not install on a fresh Mint 19 distribution. It turns out that my initial instructions left out some requirements that needed to be installed. These were present when I first used FPCUPdeluxe because of previous installations [...more]

October 9, 2018

Moteur de recherche Qwant

I added a fourth search engine to search my entire website. Qwant, like DuckDuckGo, promises to keep no information about the searches made. The site uses an unusual URL syntax to limit searches to a particular website. I decided to use an approach other than the one recommended to do this local searches. [...more (in French)]

The translation into English of the post entitled More Weather API is now completed.

September 29, 2018

More Weather API

In February, I found out how to recover weather conditions and forecasts from Yahoo Weather with a program written in Pascal. I decided to extend my exploration to other suppliers: Apixu, Dark Sky, MET Norway, OpenWeatherMap et [...more]

September 3, 2018

ESP8266/Arduino Core version 2.4.2 et WPS

Support for ESP8266 Wi-Fi connection with Wi-Fi Protected Setup (WPS) is not available in the current version of the ESP8266/Arduino core (version 2.4.2). However, it can be included by generating a new ESP8266 card definition file [...more]

September 1, 2018

Installing Ubuntu 18.04.1, Additions and Adjustements

This post is a continuation of the discussion about switching to the latest LTS version of Ubuntu. Two major applications are added to the distribution: Virtual Box and the Arduino integrated development environment. I have also added Timeshift which backups the system at regular intervals. Other less important topics discussed are the removal of the annoying emoji icons in Thunderbird and the addition of the Microsoft's core fonts [...more (in French)]

August 17, 2018

Installing Free Pascal and Lazarus with fpcupdeluxe on Ubuntu 18.04

Lately, I installed the newest (svn trunk) versions of the Free Pascal compiler and the Lazarus IDE from scratch with the fpcupdeluxe tool on a fresh Ubuntu 18.04.1 desktop. There was a slight complication associated with OpenGL libraries. But after much, self inflicted, tribulations everything seems to be working as expected. [...more]

I renamed the February post about Free Pascal / Lazarus on Ubuntu 17.10 to better differentiate the two posts.

August 13, 2018

Installing Ubuntu 18.04.1

This long post is composed of my notes for future reference that describe the installation of Ubuntu 18.04.1 on an empty hard drive. I preferred to install the new version of Ubuntu rather than update version 17.10 used since November 2017. [...more (in French)]

June 24, 2018
Update: June 27, 2018

A Third ESP8266 Watchdog, Final Version

At last, the final version of the loop watchdog is available as a library that can be loaded into the Arduino IDE. This version only works with the real-time clock RAM of the ESP8266. [...more]

June 12, 2018

Automatic Recovery from a Cycle of ESP8266 Restarts

This post, a continuation of the one of June 9, proposes a strategy for breaking out of a cycle of restarts caused by an exception or the action one of the ESP8266 watchdogs. Assuming it's the consequence of a programming error, it proposes an automatic over the air download of an earlier version of the ESP firmware. [...more (in French)]

June 9, 2018

A Third ESP8266 Watchdog, Simplified Version

Rather than translate the three English language posts about ESP8266 watchdog timers that date from August and September of last year, I decided to rewrite them in French hoping to stumble into a clearer presentation and producing simpler code. In this post, a simplified version of a third watchdog created to detect when the main loop of an Arduino sketch is no longer executed is presented. [...more (in French)]

June 5, 2018

A Better ESP8266 Loop Watchdog with Better Recovery UPDATE

While working on an ESP8266 project, I was disappointed with my loop watchdog. It did not report the name of the "module" in which the watchdog was biting. The cause of the error was difficule to ascertain. Hopefully the problem has now been found. The corrected archive is now named

Looking over the code, I decided there was room for improvement... of course. I have rewritten the version that works with RTC memory, I have yet to try the revision with EEPROM memory. And of course, I will have to test thoroughly. [...more]

May 25, 2018

Blinking a LED, an Arduino Library

This is my second Arduino library that takes care of the minutia of flashing a LED. It's a blinky! Obviously, there is nothing much to it, I just wanted a reusable module that had some flexibility yet was simple to use. [...more]

May 23, 2018

Detecting Multiple Button Clicks in an Arduino Sketch

The Sonoff (an ESP8266 device often mentioned here) has one user input: a push button. I needed a routine to return the number of times the push button was pressed in quick succession or to indicate that the button had been pressed for a long time. With help from expert artcles found on the Internet, I implemented an Arduino library that meets my need and seems to work with all boards. [...more]

May 16, 2018

Internet Radio Player based on MOC

Presenting an internet radio player for Linux based on the Music On Console player. It is a test bed for an Internet radio player to be built around a Raspberry Pi to be connected to an older sound system. The source code is available. The application written with Lazarus, the open source Free Pascal RAD IDE. [...more]

April 9, 2018

CSS float and clear attributes and clearfix

In HTML, floating areas in a <div> type block do not change the size of the block. This can result in a local alignment problem. There are more or less well-known solutions, this is about some of them [...more]

April 6, 2018

Using Multiple Search Engines From A Single HTML Form

Just two days ago, I removed the search bar from the top of every page on this site. I wanted to have more than one search engine but I did not have a compact way to do it. Then I thought of an input box for the search words followed by three buttons for each of the search engines [...more]

March 2, 2018

The cthreads Unit in Linux (Free Pascal)

Pursuant to the previous post, this is another short note about enabling threads in Free Pascal programs for the Unix/Linux environment. [...more]

February 24, 2018

Running a Process in a Thread (Free Pascal)

Another Free Pascal short note about running a process in a thread. In it I show how the aplay utility can be launched to play a wav file in a thread so that the application GUI remains responsive and it becomes possible to stop aplay at any time [...more]

February 23, 2018

Updating Free Pascal and Lazarus with fcpupdeluxe on Ubuntu 17.10

This is just a short note about using FCPUpdeluxe to upgrade or install the Free Pascal Compiler and Lazarus IDE and LCL on a Linux system. I assume that it would be mostly the same on a Windows system. [...more]

February 17, 2018

The Yahoo! Weather API with Free Pascal

Mea culpa for a very local solution to getting weather reports in a previous post which would have been of interest to only a few. Here is a solution using Yahoo! YQL queries with a potentially wider audiance [...more]

December 14, 2017

Python 3 virtual environments

As I have been trying to learn Python by dabbling with voice recognition and home automation project, it has become obvious that I had to familiarize myself with virtual Python environments. The principle is not difficult, but I ran into practical problems. This post, more than two weeks in the writing, describes how I now manage and use virtual environments on three different Debian based Linux distributions. [...more]

October 17, 2017


Since the end of May, the company hosting my website has been providing SSL certificates (OpenSSL from The site can be browsed securily with the HTTPS protocol. That should inspire confidence; the little green padlock is now visible in the address bar. There was a catch, the style files and images were no longer found when viewing files in sub-directories. A solution had to be found. [...more (in French)]

September 11, 2017

A Better ESP8266 Loop Watchdog and Better Recovery

This post continues with improvements to the third loop watchdog introduced in the previous post. But most importantly, it provide a useful technique to recover in a hands-off way to watchdog timeouts and exceptions. [...more]

August 28, 2017

Arduino Sketch Managed ESP8266 Watchdog

Adding a third watchdog is a good idea for some ESP8266/Arduino based projects. That's because it is very easy to write code that feeds the built-in watchdogs but nevertheless goes off the deep end. The task of this watchdog is to ensure that the Arduino loop is executed regularly. [...more]

August 26, 2017
Updated: August 27, 2017

ESP8266 Watchdogs in Arduino

While the hardware and software watchdog timers of the ESP8266 are essential, they are not sufficient to ensure the kind of reliability needed in an IoT device. In a future post, I will discuss how to implement yet a third watchdog to further improve the dependability of the firmware programmed into this chip. In the mean time, I thought it would be useful to discuss watchdogs in general and to delve into some of the details of the ESP8266 watchdogs. [...more]

March 14, 2017

Translating Console Applications in Free Pascal

Lately, I noticed that DefaultTranslator and LCLTranslator cannot be used to select a language in a console applications. They pull in the complete LCL package and the SetDefaultLang wants to translate all of the forms in the project even as there are none. So I decided to rip out the form updating code in LCLTranslator and to save that modified version in a unit called UnitTranslator [...more].

I found this out when looking at the tcalc demonstration program for my simple parser. I have updated that project accordingly [...more]

January 30, 2017

NodeMCU, MQTT and Domoticz - part 2

This post continues the exploration of NodeMCU, MQTT and Domoticz begun on the 15th and 17th of January. The subject is how to subscribe to MQTT messages in NodeMCU so as to perform a task based on messages published by other devices to the MQTT broker. In particular a virtual switch in the home automation software will set the WeMos D1 Mini LED on or off [...more]

January 21, 2017

Wemos D1 mini and NodeMCU - reworked

The January 15th post has been reworked slightly to better explain the work flow when using NodeMCU with command line tools. In particular, setting the baud rate correctly makes for a smoother experience [...more]

January 17, 2017

NodeMCU, MQTT and Domoticz - part 1

This post continues with the previous one. In it I show how to establish a WiFi connection and how to update a device (a temperature sensor) in the home automation software Domoticz. This is done in two ways: using an MQTT broker and directly using an HTTP request [...more]

January 15, 2017

Wemos D1 mini and NodeMCU

When I purchased my first ITEAD Sonoff WiFi switches, I also got a Wemos D1 mini board. I thought using a ESP8266 development kit would be a good way to prepare for hacking the switches. In this post, I relate how I learned to program the ESP8266 using a tool chain made up of NodeMCU firmware and Python command line utilies: esptool, nodemcu-uploader and miniterm. [...more]

August 30, 2016

Conversion of measurement units

Free Pascal's run time library contains Delphi compatible units ConvUtils and StdConvs. Unfortunately, both units contain a few errors. Lately, I have attempted to fix the code and hope to eventually submit these corrections for inclusion in a future version of the compiler [...more]

July 13, 2016

One Pass Mathematical Parser

While porting code to FreePascal/Lazarus, I have made some changes changes to the mathematical expression parser I initially wrote in Delphi. The one pass parser for Free Pascal is complete, so is the documentation [...more]

July 6, 2016

List Separator in Linux

There is no default list separator in Linux. In that case, what value does Free Pascal assign at startup to the ListSeparator field of the DefaultFormatSettings? The short answer is that the list separator is the comma ‘,’ as used in the USA and it is not adjusted according to the user’s locale. That is not always acceptable []

April 4, 2016

Free Pascal/Lazarus gotchas

After running into yet another small difference between Free Pascal/Lazarus and Delphi, I decided to write up a few of these gotcha's. They have to do with assigning procedural types and event handlers, calling a function without parameters using a procedural variable, and the rather similar problem of recursion of functions without parameters. I have also covered the creation of Debug and Release build modes and the addition of DEBUG and RELEASE symbols in the appropriate build mode [...more].

January 27, 2016

Sliderbars - Part 2

Two new components have been added to the package discussed on the 24th. The first, called TSliderPlane, is a two-dimensional version of TSliderBar. The second component is called TColorPlane. It is very specialized, showing any plane in the RGB cube. It can be used to build a colour selector with just two or three lines of code. [...more]

January 24, 2016

First Lazarus component: sliderbars

My first components for Lazarus, slider bars, , are now available. They can be used to make an RGB colour selector dialogue. See how simple it can be in the second demonstration program included in the archive. [...more]

This page lists posts published in the last two years on the subject of programming. Archives contains links to all the pages published on this site. It is also possible to do a searches limited to the content of this site with the search box at the top of all pages.