Archive for November, 2018

For someone who likes to write all their IOT code in Ruby, and has a lot of really useful libraries already, it’s getting harder when you experiment in IOT. It looks like Python has taken over almost everything.

And when you buy a shield (HAT/PHAT) for a raspberry Pi the drivers are almost always delivered in Python – especially from good suppliers like Adafruit and Pimoroni.

A good example is my “Scroll Phat HD” board for the raspberry Pi Zero W – it’s a really useful and good way of displaying small amounts of data – as you can scroll the text sideways very easily with their libraries with very little additional code, if you are using Python.

NewImage

A Scroll Phat HD in all it’s glory.

This was until I found pycall – giving me a easy way to use Python libraries directly from Ruby.

NewImage

and it works! Here is a short code example for using the Scroll PHAT HD python library

require 'pycall/import'
include PyCall::Import
pyimport 'scrollphathd', as: 'scroll'
width = 17

puts "loaded libraries ready to call scroll"
# First clear the display
scroll.clear()
scroll.set_brightness(0.2)
streng = "This is a long string"
scroll.write_string(streng + " ", x=width, y=0)
scroll.show()
teller = 0
while teller < (streng.length) do
scroll.scroll()
scroll.show()
sleep(0.1)
end

It could not be simpler – and of course I run it all directly on the Raspberry PI. Now I can both have the best of both worlds.

Yesterday I posted a little quote for the Norwegian and UK prime ministers after they had met – basically giving their nationals living in either the countries as expats the right to remain residents, even in the case of a no-del Brexit.

Reflecting on this I find it a very strange thing to do for the British PM – singling out one country (even if its to my personal advantage) for special treatment seems a odd thing to do. It’s almost a preparation for a no-deal Brexit?

OCTOBER 30, 2018 / 1:11 PM / 11 DAYS AGO
UK, Norway agree right to remain for their citizens after Brexit

Nerijus Adomaitis, Gwladys Fouche
3 MIN READ

OSLO (Reuters) – British citizens already living in Norway and Norwegian citizens living in Britain will have the right to remain residents, even in case of a no-deal Brexit, the prime ministers of Britain and Norway said on Tuesday.”