Detecting keyboard input in Python

At our last Hull Raspberry Jam, one of our budding Python coders asked me how she could detect keyboard input in a Python script and perform different actions dependent upon which key was pressed.

We both did a bit of searching around and found a few sample pieces of code, but none of them quite did what we wanted. As we were leaving I said that I would research it a bit more, and if she had not found out how to do it before the next Hull Raspberry Jam, I would have some working code for her to use.

I don’t want to ruin the surprise about what her plan is, but needless to say, it will be a very cool project if she completes what she wants to do, more on that later!

Continue reading Detecting keyboard input in Python

The Pi, The Parliament and The Palace

Over the past couple of months I have been lucky enough to be invited by the Raspberry Pi Foundation to attend two of their events in London.

The first of these events took place on September 8th, on the terrace of the Houses of Parliament, to celebrate the sale of 10 million Raspberry Pi computers. The event was attending by a wide cross-section of the Raspberry Pi community and afforded me the opportunity to meet with many people who I had, until then, only had had the pleasure of working with on-line. This opportunity also introduced me to a wide range of other partners and people involved in the development and engineering of Britain’s best-selling computer to date.

The second event I was invited to attend was held on the 5th October;  a reception at St James’s Palace hosted by the Raspberry Pi Foundation’s patron, the Duke of York. This event was a celebration of, and a “thank you” to, the many different people and organisations who support and make up the Raspberry Pi community. Again, this event gave me the opportunity to meet up again with many familiar faces and get to know a few new faces, too!

Continue reading The Pi, The Parliament and The Palace

Extract RGB Values from an Image

Our Head of Physics today asked me if there was any code we could use that would demonstrate to his A-Level Physics students the way that digital images are represented by red, green and blue pixels with a value between 0 and 255. The reason is because of the introduction of a digital imaging unit within the new A-Level specification, and whilst this could be taught as pure theory he felt a working example to illustrate the point might help.

This got me thinking and after a bit of searching I found a Stack Overflow post which gave an example of retrieving a single pixel’s RGB value and printing it out.

This example makes use of the PIL python library, which unfortunately has not been updated for Python 3. However we can make use of the Pillow library in Python 3 to achieve the same thing!

The image I have used in the code is this one:landscape

Continue reading Extract RGB Values from an Image

Embed a Twitter Feed into Moodle

In a recent #NT2tEU Twitter chat someone posed the question about how you link Twitter and Moodle together. There were suggestions about using your Twitter account to post messages about upcoming events and assignments in Moodle, linking back to them with the URL.

The way I tend to use Twitter and Moodle together is the other way round. I let Moodle take care of sending out the emails it needs for notifications, and I use Twitter as a way of pulling interesting feeds of information back into my Moodle courses.

To do this we are going to set up a Twitter Widget and then embed this code into a HTML block on our Moodle course page

Continue reading Embed a Twitter Feed into Moodle

Raspberry Jam Logo

Hull Raspberry Jam – 23rd April 2016

This weekend I was lucky enough to be involved with hosting the second Raspberry Pi Jam event that Hull has seen. Through Twitter, Claire Garside and myself got talking and a tweet of my Raspberry Pi robot I was building one weekend, led to a discussion about re-igniting the Raspberry Jam events in Hull.

Thanks must go to Claire and the Leeds Raspberry Jam team for the loan of all the equipment which allowed our event to go ahead. Thanks also must go to Malet Lambert and Stephen Logan for allowing us to use their space.

The event kicked off with an introduction to the Raspberry Pi and allowed people to get hands on setting up their Pi and getting everything running. They then had a chance to hack a Scratch game and try to improve it.

Continue reading Hull Raspberry Jam – 23rd April 2016

#Picademy Day 2 – The results

So as I went into day 2 of #Picademy I had decided upon a “motion activated camera which tweets the photo taken along with a random poem, giving you a LED countdown indicator” for my project.

Some of this I had previously coded (the random poem part) which you can see running in this Trinket app below:

My thoughts were that I could make use of this to create the text of my tweet adding the #Picademy hashtag to the end too.

Continue reading #Picademy Day 2 – The results

#Picademy – Day 2 Planning

So after day one of #Picademy my evening was spent thinking about, and reading about what I could do for my project on day 2.

My initial thoughts was to use a USB microphone to get an audio feed into a Raspberry Pi to then try and use Python to “listen” to the microphone and react to different audio levels coming in; a kind of graduated analogue switch if you like… So between #Picademy finishing and meeting up for the evening meal I spent my time walking (quickly!) around Manchester trying to find a shop selling basic USB microphones; to no avail!

So over the evening meal I was discussing this idea more with Les and we thought it maybe possible to use the Jack Audio Server to flip the Pi’s inbuilt headphone jack into a microphone jack. This is possible on Ubuntu, as a quick search on our phones verified; so I thought we were on to a winner here. However after a little playing around with my Pi back at the hotel, it turns out that the HDA-Jack-Retask application just does not work with the Raspberry Pi soundcard 🙁

This left me back at square one… What do to on day 2?

So I wake with this thought… “A motion activated camera which tweets the photo taken along with a random poem, giving you a LED countdown indicator” – Should be easy!

Watch this space for progress!

#Picademy – Day One

This February I was one of the lucky few to be accepted on the Picademy event at Google’s Digital Garage in Manchester. More details about the event can be found here: https://www.raspberrypi.org/picademy/google/manchester/

This post is a summary of my thoughts after day one – more as a memorandum for me than anything else. Apologies if I have forgotten any of the sessions or put them in the wrong order; to coin a phrase used in the training, I reached “cognitive overload” fairly quickly!

Continue reading #Picademy – Day One

In defence of technicians…

This morning Mark Anderson (ICT Evangelist) posted a new blog entitled “The problem with technicians“. Now whilst I agree with a lot of what Mark said in this post, I also felt that perhaps my experience and point of view would be able to tell the story from the other side, so to speak. I feel that having worked as an IT Director in schools for the past 8 years, as well as having been seconded to other schools to analysis and resolve their ongoing IT issues, and now also having taught in the classroom for the past two years; I have some insight into the issues Mark talks about which I felt I wanted to share.

I will structure this post in terms of the points I agree with Mark on, where I differ from Mark’s view point and what I think the best solution for supporting IT in schools is.

So firstly what do I agree with…

Continue reading In defence of technicians…