# jon black

"I am in a charming state of confusion"

When you get started with programming one of the first obstacles is picking a language. A mistake beginners often make is asking experienced developers where they should start:

The truth is it doesn't matter.

The first programming language I was taught was Pascal. This was long after my childhood experiments with ST BASIC. The year was 1998 and I was 17 years old. In case you're not familiar with pascal, here's its "hello, world":

program HelloWorld;
begin
WriteLn('Hello World')
end.


I've not used this language since. If you were to ask me to write a program using this language now, I'd need a book. In fact, I had to search for the example above.

That doesn't mean it was a waste of time. Through Pascal I learned basic programming concepts such as variable assignment, loops and if statements; it even introduced me to object oriented programming.

I had a

Introducing arduino-fsm, a library that makes it easy to use a finite state machine in an Arduino project.

# Design

This library is composed of two classes: Fsm and State:

 State Represents a state in the state machine. A state has two callback functions associated with it: on_enter and on_exit, which are called when the state is entered into and exited from, respectively. Fsm Represents the state machine. Transitions are added using the add_transition function. This function takes pointers to two states, an event id, and a callback to a function that's called when the transition takes place. Calling trigger with the event id invokes the transition, but only if the Fsm is in the start state, otherwise nothing happens.

# Tutorial

First create the Fsm and State instances at the top of your source file.

#include <Fsm.h>

#define FLIP_LIGHT_SWITCH 1
Fsm fsm;
State

Introducing the arduino-menusystem library that makes it easy to incorporate a menu system into an Arduino project.

# Design

The library is implemented according to the composite design pattern. When using this library you need to create Menu's, MenuItem's, and a single MenuSystem.

 Menu A Menu represents an item in the menu that contains other Menu's and MenuItem's. Use add_menu_item() and add_menu() to build its contents. MenuItem A MenuItem represents an action. When select() is called the MenuItem's callback function is called. MenuSystem The MenuSystem contains the core functions for interacting with the menu system: next(), prev(), select(), and back().

# Tutorial

First create the various Menu's, MenuItem's, and MenuSystem at the top

There are an insane number of devices connected to The Internet, and it's growing at a crazy rate. In 2012 Cisco estimated around 8.7 billion, and that figure in 2015 jumps to a massive 15 billion.

Think about that for a second.

In three years, the number of devices has grown 58%. If that were to continue, in 15 years there'd be a staggering 146.1 billion devices!

You're living at the dawn of The Internet of Things. Your fridge. Your toaster. Your thermostat. Your car. You washing machine. Your dishwasher. Even your lightbulbs will be connected.

On the one hand this is really cool. You can control your lights with your phone, and by mining all the data from these devices, perhaps your food shopping can be ordered by your fridge, or your electricity meter can find a cheaper electricity plan? Even your baby's nappy can tweet when

In How to compare GPS tracks I showed how the Needleman-Wunsch algorithm, originally designed for aligning DNA and protein sequences, can be used to compare GPS tracks.

The method I introduced relies on pre-processing the GPS file so that all points are evenly distributed to reduce noise in the data set, but I didn't cover how that's done.

# Trace the path

Starting from the first point, the path is followed and the great-circle distance between each point is accumulated until it exceeds the desired distribution distance.

When the distance has been exceeded, a new point is interpolated between the current point and the previous point.

gpxpy has a function for moving points when given an angle and a distance in meters. The distance is the accumulated distance minus the required distance. gpxpy doesn't have a function for calculating the angle, otherwise known as initial bearing, between two points. Using the