Scratch (well almost) and the ISS

This is just a very short post for the Naas-Sallins Coder Dojo about a smaltalk clone of  Scratch called Phratch. As the website says “ It includes two interesting categories: Files and colors. Files allows one to manipulate local and remote files, and Colors to manipulate color features”. So in this quick post we are going to have a look at the files extension.

Phratch Files Section

Phratch Files Section

The first item here is the one we are going to use by pointing the url at the open-notify api from our previous posts. Our very short 8 line program is as follows

Phratch ISS Tracker Code

Phratch ISS Tracker Code

Inside a standard ‘When Green Flag is clicked-Forever loop’

we set the variable mydata to the contents of our api call

we set the variables lat and lon to a particular range of characters in my data. I did this by trial and error and its a bit rough and ready.

we then set x and y to the lat and lon adjusted to match the dimensions of the display window size (360×480) to standard latitude and longitude (180×360)

finally we sleep for a minute

The sprite to represent the ISS position is a simple blue dot with the stage background set to a map of the world. The map projection I used was from a python basemap example with a quick photoshop adjustment to crop it to size. The Equidistant Cylindrical Projection matches the requirements of our display window and our result turns out to be pretty decent

Real-Time ISS Tracker

Real-Time ISS Tracker

So as you can see the ability that phratch has to interact with a file or a url opens up a whole new set of interesting opportunities.

If you are interested you can download phratch here.