Tag Archives: programming

Arduino: running hard to stand still

Don’t you hate it when something that was working stops? You can safely bet that it’s because, somewhere along the way, something has been ‘improved’. I needed to make a change to the code running on a couple of IoT room thermometers. These are built around the Adafruit Huzzah ESP8266 board (the non-Feather version). And they’ve been running flawlessly for months…. Read more »

SmartParallel: Go code is go

      No Comments on SmartParallel: Go code is go

Success! The Go code I’d been struggling with is working, although it also required changes to the C++ code running on the ATMEGA328PB. Here’s a quick overview of how the process works. On the SmartParallel, the ATMEGA328PB code sits in a loop watching for incoming data on the serial port. It also monitors the state of the printer by frequently… Read more »

SmartParallel: n steps back, n+1 steps forward

The principle of ‘one step at a time’ is very sound. The more changes you make at once, the more places there are for bugs to hide. And that’s why this project has been progressing slowly – or not at all – just lately. Finally, though, I feel like it might be back on track. A quick recap: SmartParallel is… Read more »

Go or Python for the Raspberry Pi

Pretty much all of the code I’ve written for the Raspberry Pi (and the BeagleBone for that matter) has been in Python. It’s widely regarded as the de facto language for the platform, not least because it is newbie-friendly. But does it have to be this way? Ups and downs of Python It’s not hard to enumerate a long list of… Read more »

Go on Raspberry Pi: simple cross-compiling

Go – or Golang if you prefer – is a powerful programming language, applicable to virtually any platform, from single-board computers (SBCs) such as the Raspberry Pi to supercomputer clusters. I tend to work at the lower end of that scale. And I was motivated to check out Go because it has a reputation for being fast – unlike, say,… Read more »

AVR basics: reading analogue input

It’s an increasingly digital world, but not all information comes packaged neatly in 1s and 0s. Sometimes you have to deal with analogue voltage levels using the microcontroller’s analogue to digital (ADC) converter. Measuring analogue voltages is made easy in Arduino projects because the IDE comes with a handy analogRead() function. Providing your input voltage does not exceed what the… Read more »

First BBC Basic program: mission creep

It’s always the same. “I’ll just hack out this quick program,” you think. And you get it to the point where it works and does the job you intended it to do. But then: “Maybe it would be nice if it also did this…” And even when you’ve added all the functionality the program will bear, and your wife is… Read more »

First time with BBC Basic

      No Comments on First time with BBC Basic

So what was your first program? You know, the first one that meant anything. My guess is that when you unwrapped your first home computer (mine was a Sinclair Spectrum 48K) the lines of code you typed were little more than snippets – changing some colours on the display, perhaps, or making rude words scroll endlessly down the screen. You… Read more »

Flowchart your way to success

      7 Comments on Flowchart your way to success

Does anyone still use flowcharts for programming? What with today’s complex development frameworks it seems unlikely that anyone’s stopping to draw diagrams on paper. But maybe if they did we’d have fewer security vulnerabilities – just sayin’. My addiction to computers, in the early 1980s, was driven in part by ‘30 Hour Basic‘, an introduction not just to the language… Read more »

DottyMatrix software stack: PHP & Python messaging

On the Raspberry Pi that I’m using to control my DottyMatrix serial-to-parallel Centronics printer interface there are two main software components – a web-based PHP/JavaScript front-end UI and a back-end server programmed in Python. So these need to talk to each other. Here’s the overall architecture of the solution: The matrixSvr.py program is intended to run permanently on the RPi… Read more »

AVR basics: using the I2C bus #4 – receiving data

Part 1 – bit rate Part 2 – transmitting Part 3 – sending data Part 4 – receiving data Part 5 – final thoughts This builds on the previous two posts that dealt with the fundamentals of sending data over the I2C bus on AVR microcontrollers and then how you actually do it. Receiving is a similar process, except for… Read more »

AVR basics: using the I2C bus #1 – bit rate

Part 1 – bit rate Part 2 – transmitting Part 3 – sending data Part 4 – receiving data Part 5 – final thoughts When I first started playing around with Arduinos I quickly grew to like the I2C bus, and for a couple of good reasons. First, it was easy to use. And second, there are lots of fascinating… Read more »

Do you know what your code’s doing?

It seems like an obvious point, but it’s sometimes handy to know what your code is up to. If you normally write code for desktop systems – and especially if you’re hacking out something that works on the command line – then it’s easy. Just pepper your program with print statements to show the state of play. (Then try to… Read more »

ESP8266 and MicroPython: first scripts

So I have MicroPython installed on an Adafruit Huzzah ESP8266 dev board. The next step is to get it to run something. MicroPython establishes a basic filesystem using the board’s flash memory. This is handy for storing configuration and data files. And it supports a directory structure. But there are two files in particular you need to get to grips… Read more »

AVR: Battling bizarre bugs

      1 Comment on AVR: Battling bizarre bugs

Do you ever get the feeling that a compiler is acting weird just to mess with your head? That’s how it felt yesterday. I was tinkering with the code for my HexMonitor. This uses an ATMEGA328P microcontroller to read values in from an eight-bit data bus or a 16-bit address bus (selectable via a switch) and display them on a… Read more »