Home Assistant – notifications on iOS

Home Assistant has a nice iOS integration with the Home Assistant for iOS app. In this post I will describe how I have used the notify platform in Home Assistant to get notifications on my iOS devices when the front door of our house is opened.

Continue reading →


Blynk, PlatformIO and ESP32

Blynk is an IoT-platform that consists of a Blynk server, custom projects within an iOS/Android mobile app and custom hardware IoT-nodes (Arduinos etc) using a Blynk library. The mobile app communicates with the hardware via the Blynk server and you can use the mobile interface for displaying sensor data from the hardware nodes or control actuators on the nodes.

You can use the cloud version of the Blynk server or host your own instance. In this post, I will show how I have setup a Blynk server on a Raspberry Pi and how I am using it for mobile communication with an ESP32 board that is developed with PlatformIO for Atom.

Continue reading →

Adventures in Swift: Playing with CMMotionManager and gravity

I recently added an iOS game embryo to GitHub: https://github.com/LarsBergqvist/GravityBall

It’s a SpriteKit-based game in Swift 2.0 where you tilt the device to roll a spike ball around with the aim of smashing an infinite number of balloons.

Yes, it’s an endless game with no more purpose than destroying balloons for pure pleasure. But the major stakeholder for this piece of code likes to play it (my 4-year old son that currently has an obsession with physical balloon annihilation – with an app there’s much less to tidy up afterwards).

The code illustrates usage of accelerator data and multiple gravity fields. The physic’s world has a normal vertical gravity field, but there is also a SpringField in the middle of the scene that interacts with the balloons so reaching the balloons gets a bit harder.

I will use this game template for a complete maze ball game in the near future (do you remember those wooden games from BRIO in a not so distant past when there were no computer games around?) – perhaps with some Pac-Man ghost as enemies in the labyrinth.

Game on!

Adventures in Swift: Making a blasting shoot’em up

For further fun and learning with Swift and game design, I decided to make a space shoot’em up in classic style for iOS. The code for the game can be fetched from this repository in GitHub: https://github.com/LarsBergqvist/BlasterMaster.git


Game idea

The player commands a ship at the lower part of the screen and can move to the left and right to aim at enemies and upwards to trigger a thrust at the aliens spawning ground. The background moves slowly downwards which creates an illusion of constant upward movement. Evil invading aliens ships appear from the top of the screen and moves downwards, sometimes shooting red deadly laser beams. The player’s task is to laser-blast the aliens to infinity and beyond without being hit by the aliens ships or lasers.

Continue reading →

Adventures in Swift: simplifying platform game level design with SpriteKit

Since my formative Commodore days (and even before with Colecovision), I’ve always loved platform games, and now I’ve found a fun programming exercise in making one for iOS. I have already explored the basics of Swift, Xcode and SpriteKit in my previous post, and now I am going further with the game level design.

Continue reading →