Friday, 28 November 2014

Oh the weather outside is frightful, but the fire is so delightful. And since we've no place to go, let it snow, let it snow, let i snow virtual python turtle snowflakes across my Raspberry Pi screen!

Yes, it is that time of year when I break out my christmas jumper, put Frozen on repeat and start eating Lebkuchen by the bucketload. coincidentally, it is also Computer Science Week 8th December to 14th December 2014 and Code.org are asking everyone to take part in just one hour of code. They have created a website full of activities for any ability or interest and one really caught my eye. It is called 'Artist with Anna and Elsa from Frozen'!

I love making patterns with code, as you may remember from episode 27! There is a wonderful python module called turtle. In fact turtle has been around for a long time, and I fondly remember typing my first computer code into a BBC micro to make a turtle draw a square. Therefore I have a bit of a head start, and so the Anna and Elsa activity on code.org only took me a few minutes. As I like a challenge I thought I'd see just how far I could push myself with python turtle to create similar snowflakes.

I created a python program to draw snowflakes at random places in a window with random pen colour!

If you would like to learn how you can create snowflake shapes with code then check out my latest episode:

If you would like to take a look at my final code then you can clone if from my github page or just take a look here!

Thursday, 27 November 2014

In a former life I was a computing teacher, a job I enjoyed very much. I had the good fortune to meet and teach some wonderful young people who are still in contact with me today. One of them contacted me recently to ask that I help back their competition entry in the Queen of Code. The Queen of Code Campaign is an amazing campaign that is helping push the way for females in the computing world by driving equal opportunities for all. They have teamed up with Creative England and Crowdfunder this time to help push female Game Designers get the recognition that they deserve.

You can help them reach the top 5 by backing their project 'Junior Ninja' for as little as £2. I did back their entry and I hope you will too after you read a little about them:

Who are Stealthy Badger Studios?

Stealthy Badger Studios is an indie games development team based in london. We are currently a team of 6 with our only female team member Tish leading us. Currently we are developing a mobile game called Junior Ninja and are taking part in the Queen of Code campaign with Creative England and Crowdfunder.

The Queen of Code Campaign is an amazing campaign that is helping push the way for females in the computing world by driving equal opportunities for all.They have teamed up with Creative England and Crowdfunder this time to help push female Game Designers get the recognition that they deserve.

Junior Ninja is a 2D platformer for mobiles which sets our ninja, Ned, challenges and training to help him pass his ninja exams and become a fully qualified member of the team. Help Ned move, Jump, and fight his way to glory while collecting as many coins as possible. We’re currently looking to publish our simple prototype online for people to play, so players can get a feel for the style of gameplay. However, this means players will be greeted by Square Ned, as Ninja Ned is still a working progress and we need your help to hire artists to make Ned look his best!

Wednesday, 12 November 2014

Ever wanted to make an interactive digital landscape? Flowers are great, but they die too quickly. I'd much rather have some flowers that I can enjoy at any time and that spin at the touch of a button! In this tutorial I will show you how to get started with Pibrella and Python 3 to create your own digital garden on a Raspberry Pi.

What you will need:

Create your Spinning Flower

Take two male to male jumper wires and cut off the connectors at one end. Strip the wires and solder them to the two contact points on the motor. I also added some hot glue once the solder had dried over the top to make the joint more stable and less likely to break. You may need some help from an adult to do this.

Optional step: If you would like to use your motors later for a roving robot, or to help stick your flower to the motor, glue on a wheel like this one. I used some very strong glue, so make sure that you get the help of an adult to help you do this.

Design your flower by either cutting out a template like these, or by drawing and cutting out your own. Using blu tack and a drawing pin, add your flower to your wheel or motor.

Add a Pibrella

Plug your pibrella into your Raspberry Pi. It should fit over the first 26 GPIO pins. Ensure that there is a rubber foot underneath so that the metal parts of the pibrella board do not touch the HDMI port on your Raspberry Pi B+ (as this could short the Pi).

Look on the Pibrella board for whee it says 'Out'. Beneath are a number of ports that have been labelled. Look for the row marked 'E' and push the other end of the flower/motor jumper cable into the ports next to each other. (It doesn't matter which way round as long as they are both plugged in the row 'E').

Prepare your Raspberry Pi

Add your SD card with Raspbian on to your Raspberry Pi and connect it to a screen, keyboard, mouse and power. You can plug the micro usb power into the pibrella board and it will power your Pi too.

Log into your Pi and load the GUI by typing 'startx'. Once loaded, open an LXTerminal window and type in the following commands:

sudo apt-get update sudo apt-get upgrade

Once this process is completed (it may take a few minutes) you are ready to download and install the pibrella python 3 library to control your motor. In the same LXTerminal window type:

sudo apt-get install python3-pip

followed by:

sudo pip-3.2 install pibrella

Now you can load the Python 3 programming environment IDLE3 by typing the following:

sudo idle3 &

Let's write some code!

Opening IDLE 3 as the super user allows you to control the GPIO pins with your code in IDLE 3.

Once the application has opened click on File and New Window. Then save the file as spin.py by clicking on File and Save As.

Begin your program by importing the libraries that you need to control both the Pibrella board and time.

import pibrellaimport time

Now we can add lines of code to turn on the motor, wait for a period of time in seconds, and then turn off the motor connected to output 'e' on the Pibrella board.

pibrella.output.e.on()time.sleep(8)pibrella.output.e.off()

Save the file and run it by clicking on Run and Run Module. You should now have a spinning flower!

Follow the video tutorial to find out how you can use loops and functions to improve your creation!

About Me

A collection of video logs about inspirational women in the fields of computing, science, technology and engineering.

I noticed that the uptake of these subjects by teenage girls in higher education was limited, and that female students would opt for more creative and academic subjects like Art, Dance or Humanities. I wanted to develop a network of individuals who could inspire a new generation to take up more traditionally geeky subjects. The theory being that if students can see how creative some careers are that they would be more inspired.