Seasonal change for the day clock

Today was a lovely summery day in old Blighty.  It was good to generate some vitamin D, but I guess that was our summer over for another year.  If you blink then you miss it.

It reminded me that my day clock needed updating. The old autumnal leaves I posted originally back in December no longer seem appropriate. So today I added a rolling background image that changes with the seasons. There is a different image for each time of year: Spring, Summer, Autumn and Winter.

Do please check it out.

The old Autumnal version. Do click it to see what's new.

More groovy patterns for Raspberry Pi

Following on from the last post about groovy patterns for Raspberry Pi, I present my latest program, another random walk.

It is a random walk similar to last time, however with this one there are three degrees of freedom (rather than horizontal and vertical) and rather than a line, the object displayed in a coloured 3D box.
This code is for BASIC V running under RISCOS on the Raspberry Pi. Copy the code, or download directly.

The code:

   10 REM Blocks
   20 REM T Street
   30 REM 2017-05-21
   40 :
   50 MODE 19
   52 delay = 0
   55 colcyc = 0
   60 angle1 = RAD(45): angle2 = RAD(20)
   70 size = 16
   72 LIMIT = 50
   73 DENSITY = 40
   80 xo=500:yo=500
   90 x = xo: y=yo
  100 dir = RND(5)
  110 PROCsetdir
  112 lc = 0
  114 dc = 0
  120 REPEAT
  140   PROCbox(x,y,size,angle1,angle2)
  141   t=TIME:REPEAT UNTIL TIME>t+delay
  150   x = x + dx: y = y + dy
  151   lc = lc + 1
  160   IF RND(6) = 1 THEN PROCchangeDir
  170   IF x<0 OR x>1000 OR y<0 OR y>1000 OR lc>LIMIT THEN
  180     x=xo:y=yo
  181     colcyc = colcyc+2: IF colcyc > 127 colcyc = 0
  182     lc = 0
  183     dc = dc + 1
  190   ENDIF
  191   IF dc>DENSITY THEN
  192     dc = 0:CLS:x=xo:y=yo:lc = 0
  193   ENDIF
  200 UNTIL FALSE
  210 END
  220 :
  230 DEFPROCbox(x,y,s,ar,au)
  240 REM draws a box at coords x,y
  250 REM where the coords are the lower left corner
  260 REM and s is the size of box
  270 REM and ar and au are angles
  280 MOVE x,y
  290 LOCAL up, right
  300 up = s*SIN(au)
  310 right = s*COS(ar)
  320 REM front side
  330 GCOL 2+colcyc
  340 MOVE x,y+s
  350 PLOT 85,x+s,y
  360 MOVE x+s, y:MOVE x, y+s
  370 PLOT 85, x+s, y+s
  380 REM right hand side
  390 GCOL 1+colcyc
  400 MOVE x+s+right, y+up: MOVE x+s, y+s
  410 PLOT 85, x+s, y
  420 MOVE x+s+right, y+up: MOVE x+s, y+s
  430 PLOT 85, x+s+right, y+s+up
  440 REM top
  450 GCOL 1+colcyc
  460 MOVE x+right, y+s+up: MOVE x+s, y+s
  470 PLOT 85, x, y+s
  480 MOVE x+right, y+s+up: MOVE x+s, y+s
  490 PLOT 85, x+s+right, y+s+up
  491 GCOL 0
  492 MOVEx,y:DRAW x+s,y:DRAW x+s,y+s:DRAWx,y+s:DRAW x,y
  500 ENDPROC
  510 :
  520 DEFPROCsetdir
  530 CASE dir OF
  540   WHEN 1
  550   dx = 0: dy = size
  560   WHEN 2
  570   dx = size: dy = 0
  580   WHEN 3
  590   dx = 0: dy = -size
  600   WHEN 4
  610   dx = -size: dy = 0
  620   WHEN 5
  630   dx = -(size*COS(angle2)): dy = -(size*SIN(angle2))
  635   WHEN6
  636   dx = (size*COS(angle2)): dy = (size*SIN(angle2))
  640 ENDCASE
  650 ENDPROC
  660 :
  670 DEFPROCchangeDir
  680 dir=RND(6)
  690 PROCsetdir
  700 ENDPROC
  710 :


Weird things spotted in Whitby today

I went to Whitby today.

Whitby is a lovely town on the North East coast of England. Whitby is a place where you can be who you want to be. Whitby is home to the famous Lucky Duck; was the place where Count Dracula first arrived in England; and is home to the superdecade games chatbot - Mac.

You will see many strange things in Whitby. Today I saw some, and managed to get a few on camera.

Kleptoparasitism is a thing. This is how gulls feed. Just because you bought the chips doesn't mean that the seagull respects your property. I saw this gull trying to break into someone's car. When it realised that it couldn't peck through the roof, it decided to try and eat the aerial instead. Then it saw my chips and wanted some. It didn't get any. I am not sure why this fellow looks like it has a mustache, it just does.
There are many junk shops in Whitby. This one is selling a sarcophagus. The shop was closed, but there was a phone number to ring if you wanted to enquire about anything. I want to ask how much this costs, because, you know, you need somewhere to sleep at night.
Errr, what? I don't know what the actual flip this is. Moving on....

This shop selling LPs from some of the worst vermin of society.
Sorrrrrrrry
Taken from a poster by the authorities, encouraging us not to feed the vermin of the sea - the rats with wings, the aerial-munchers, the chip thieves. Is it just me, or does it look like that photograph of Theresa May? You know the one....
....Do NOT feed (or vote for unless you can afford to sell your house to pay for your health care).

Groovy patterns for Raspberry Pi

In a spare moment whilst I was waiting for some food to cook, I decided to play with the BASIC on the Raspberry Pi. I'm using the brilliant RISCOS for the Pi which comes with BASIC V and about a gigabyte of RAM.

I decided to create a 'random walk' in an attempt to create something that would look like an abstract map of a city. I am quite pleased with the results.

Pictures first, and then the code.

It's supposed to look sort of 3D, sort of.

It really pelts along on my Raspberry Pi
When the line wanders off the screen it starts again in the middle of the pattern with a slight offset and a new colour. Lines sometimes quit and start again (controlled by the variable LIMIT%, and after a while the pattern will refresh (controlled by the DENSITY% variable).

Here is the source code for RISCOS BASIC V, which will require only minor modification to run in BBC BASIC for Windows, or on a BBC Master.

Copy the code below, or download the file directly.

   10 REM Draws a 'city scape'
   20 REM T Street
   30 REM 2017-05-10
   40 MODE 19
   50 ONERROR IF ERR=17 OSCLI("*DESKTOP")
   60 colCycle%= 0
   70 GCOLRND(4)+colCycle%
   80 REPEAT
   90   refresh%=FALSE
   99   REM Origin
  100   xo = 500 :yo = 500
  109   REM start at origin
  110   x = xo :y = yo
  119   REM distance moved each step
  120   dx=0:dy=0
  130   m = 16
  139   REM counts number of steps
  140   c = 0
  150   l=0
  160   LIMIT% = 400
  170   DENSITY% = 32
  180   MOVE x,y
  190   REPEAT
  200     c=c+1:l=l+1
  210     x=x+dx
  220     y=y+dy
  230     DRAW x,y
  240     r = RND(4)
  250     IF r=1 dx = 0:dy=m
  260     IF r=2 dx = m:dy=0
  270     IF r=3 dx = 0:dy=-m
  280     IF r=4 dx = -m:dy=0
  290     IF x<0 OR x>1000 OR y<0 OR y>1000 OR c>LIMIT%  THEN
  300       xo = xo+2:yo=yo+2
  310       x=xo
  320       y=yo
  330       c=0
  340       MOVE x,y
  350       GCOLRND(4)+colCycle%
  360     ENDIF
  370     IF l>LIMIT%*DENSITY% THEN
  380       refresh% = TRUE
  390     ENDIF
  400   UNTIL refresh%
  410   colCycle% = colCycle% + 4: IF colCycle% > 128: colCycle% = 0
  420   CLS
  430 UNTIL FALSE


Remote desktop for Raspberry Pi

Avid readers of this blog will know that I am a big fan of the RISCOS pi operating system for Raspberry Pi. I mainly use it for the nostalgia factor, however I also keep a set of note on it in addition to some programming.

I also have a need for the Linux distribution as well.  I currently regularly use Raspbian flavour of Linux for the following tasks:

These are all jobs that I want to have running permanently, however it started to annoy me that I had to quit Raspbian in order for the device to boot into RISCOS.  The solution was to get a second Raspberry Pi 2 to use as a dedicated RISCOS Pi and leave the first device for uninterrupted Linux stuff! This caused it's own problems, of course, as I only have room for one monitor, one keyboard and one mouse. Swapping the devices over when I wanted to quickly check on something on the server was becoming irritating and so the obvious solution is to install a remote desktop.

If you were not aware, a remote desktop allows you to run one computer from another computer. You literally see the desktop of one computer in a window on a second machine. This is incredibly useful for doing things with Raspberry Pi wherever the use of keyboards, mice and monitors are a problem. For example, you might want to put the Raspberry Pi in a remote location in your house or garden to monitor temperature, or take photos as aliens pass over your roof. Maybe you want to set the machine up as a burglar detection and capture system. Maybe your Raspberry Pi is the central brain of your doomsday machine or robot butler and having a monitor and keyboard attached is just soooo nineteen nineties. Either way, controlling your Pi from another computer or tablet is really cool.

Your choice of software for performing a remote desktop depends on your current distribution of Raspbian: you could try xrdp, or VNC.

XRDP

I have used xrdp on a number of Pi devices at both work and at home. These instructions should work if your device was installed before 2017.


1. First install the xrdp software onto your Pi. Navigate to the terminal and type: sudo apt-get install xrdp
2. Follow any on-screen instructions.
3. Once completed restart your device with sudo restart
4. You will need the IP address of your device on your home network. If you don't know it you should be able to find it from either your home router's admin page, or type the command: ifconfig You are looking for a line that reads something like: inet addr:192.168.1.162

5. Once you are happy that xrdp is ready for your Raspberry Pi you should be able to connect from your second computer.  In Windows 10 select Cortana and type "Remote Desktop". This should launch a program called "Remote Desktop Connection".

Finding the Remote Desktop in Windows 10. For earlier versions of Windows, it will be found in your Start > All programs > Accessories folder.

6. Type in the IP address of your Raspberry Pi from part 4 (for example, mine is 192.168.1.162).
7. Enter your username and password. You should now find that you can now see your Raspberry Pi desktop.

Enter your username and password at the prompt. If you haven't changed them already, then your username should be 'pi' and the password is 'raspberry'

If you get connection problems, then you probably need to follow the steps for VNC below.

VNC

1. Navigate to your Terminal in Raspbian and type: sudo raspi-config
2. A menu should appear. Find “Interfacing Options” and make sure that VNC is enabled.
3. Reboot the Raspberry Pi.
4. Whilst your Pi is rebooting you can install the VNC Viewer client software on your second computer. I downloaded the portable version from the RealVNC website for Windows, however other versions are available for other machines.
5. Once you have this client running you should be able to enter your IP address and connect.

If everything has gone to plan then you should be seeing your Raspberry Pi desktop on your other computer. Very handy for controlling your computer from another room.

Another really good feature is that VNC will allow you to transfer files from your computer onto the Raspberry Pi. To do this, first click on the icon in the top left corner. Then select "File Transfer" from the menu. I use this to maintain various files on my home server. For example I have a set of notes written using Zim. These notes are written on my PC and keep track of various things that are useful for both RISCOS and Raspbian (such as all the instructions on this blog article). As soon as I learn something new about the Raspberry Pi, I make a note of how I did it and then upload it to the server. As they are kept on my server I can access them from any of the machines on my home network, including the RISCOS device. Very handy indeed!




Today we celebrate two years in space

On the first of May two years ago we launched Project Poxima the world's first internet based space mission.

Project Proxima is a hypothetical, light-speed space mission to the Proxima Centauri star system. The aim is to create a teaching tool that helps explain the vastness of interstellar space (it's big).

Today Proxima has traveled nearly 19 trillion km - that's about 47% of the today distance.


A lot has happened in the time since launch: perhaps most notably are the rise of Trump and the British referendum on Brexit. Most interestingly, however, that since launching the Project Proxima mission, scientists have discovered an earth-like planet in orbit around the Proxima Centauri system.

You can get involved in the mission by following on Twitter, or tracking the progress on the website.

You can also become an official supporter and sign up for email alerts.


Want to read more about Project Proxima?

Label