Flashing the onboard LED

Ever since going to the TechnoTeach in the Village where someone mentioned you could flash the onboard Status LED from the commandline I wanted to have a go.  Instant hardware hacking without waiting for ‘bits’ to arrive.

There’s some guidelines here (ignore the first answer which says ‘not possible’ Those Who Can appear later in the thread.  The gist is that it, by default shows the activity on the SD card, but you can override that and control it from GPIO pin 16.

echo none >/sys/class/leds/led0/trigger to turn off the default behaviour
echo mmc0 /sys/class/leds/led0/trigger to turn it back on (although I haven't tested that yet!)

Once that’s done you can control it from the commandline using the following commands

echo 1 >/sys/class/leds/led0/brightness will turn the LED on
echo 0 /sys/class/leds/led0/brightness will turn it off.

Or to flash it the following module and command will work:

modprobe ledtrig_heartbeat
echo heartbeat >/sys/class/leds/led0/trigger

Having got that working to my immense amusement it was time to look at incorporating this into a program.

Python was what most of the examples were written in – something I’d never used.  Happily the Raspberry Pi Users Guide was at hand (in Kindle form floating round the classroom on a couple of tablets) and that plus the sample code here was enough to get started.

Initial hurdle was to meddle withe GPIO you need to be running as root and the IDLE ‘Run module’ command doesn’t by default.  Relaunching the editor from commandline with sudo sorted that bit.

I fiddled with the sample code to try out timing then started wondering about more uses.  Flashing a Morse code seemed the obvious thing to try and since I only know two (BCN or STU for the Brecon and Strumble VORs!) I decided to try and make it flash the code for Brecon.

Things I instantly didn’t know…

How to write to the screen in Python (easy and guessable – print “Whatever”)

The timings for Morse (how much longer than a dot a dash is, how much space is between letters etc. (Wikipedia to the rescue there)

Things that worked well

It worked!  and I tweaked it a bit to put some info on the screen as well.

I needed to comment the code heavily to not loose track of which letter I was on.

Stuff to improve /add

More realistic timing.  It’s vvveerrryyy veeerryyy slow at the moment 1 second per dit.

Variables for the lengths of the ons and offs.  At the moment I’ve coded each characters individually.  Very inefficient!

More than one station!

Free text conversion into Morse sequences.

Find out if I can run those commandline setup and close down bits to make the LED accessible from within the program itself.

Code below (I learned about the WordPress shortcode wrapper for posting code without mangling it too!

Continue Reading

Project Planning

Today we looked at breaking down the ideas learners had for what they wanted to do with the Pis into SMART targets.

We’ve looked at SMART targets before as all learners do the Improve Own learning and Performance Key Skill, but most needed to refresh their memory with a quick Google to remember the acronym!

I modelled the process first with a project I fancy having a crack at, and we started working on a collaborative Google doc.  Unfortunately although some learners are used to working this way and ready to contribute, a certain amount of silliness did set in with some at the realisation they could tamper with each other’s work.  When this didn’t subside in reasonable time and after a warning or two, we decided to have everyone download their own copy to work on and merge them back later.  This was more timeconsuming and we’ll have to work on self discipline during collaborative tasks as we go on!  Increasingly Google Docs is being used in the workplace and we’d be in a fine old state if the staff all decided to sabotage, rather than improve, each other’s contributions!

It did demonstrate how much of a learning curve there will be and how much targets breakdown needs to be practiced and reinforced.

Some very interesting ideas coming out of it too!

First workshop

A few inital hiccups (Moodle ones not Pi ones again!) when the open guest access meant registered learners too were deposited in the course without enrolling.   Sorted temporarily during the day by turning off guest access.  On again now, but learners will have to manually enroll from a link at the side rather than being prompted.

As discussed here we went through some aims and objective.  Interesting to see where the learners priorities did and didn’t match ours!  (The bid objectives tallied up but their assessment of what they wanted to learn and what we thought they needed to learn were rather further removed!

ITeC’s Aims

Our Cross-curricula requirements to get the Welsh economy and culture involved in everything we do is still proving a challenge to get learners to fully take on board.  Surprisingly they don’t prioritise awareness of the job market either – we definitely need to work on that!

Skills The Project will Need

The research and self study skills which have been a concern to the staff in the past still are not seen as a priority either.  I wonder if it’s because they think they are already good?  And how they’re defining ‘good’ – any of you out there care to comment? 😉

Most learners engaged well with the activities although I think we’ll add more direction to what we mean when we say have a god and tell us what you think!”  They have had very little practice in using different applications and systems and comparing the advantages and disadvantages – probably comes of always having been told “Use this””

We watched the following video.  Probably it’s more aimed at tutors, but we keep saying this is, in effect an adult programme and this is the level of learning that their CPD is going to need in an IT world.  Part of the Moodle course involved summarising the aims as stated in the video and everyone got the gist.

The cloze exercise for the background reading working well, prompting lots of discussion and some unexpected literacy work as we discussed how we could get clues from whether the sentence meant the gaps needed a singular or plural answer!  I’ll definitely use that again!

For the practical part we had two Pis (one a learner’s own) between 8 so had a two small groups working on the Pis and a third using live USB boots to try out Linux itself.

There’s some more writing to be done on the wiki but overall it went well.

Raspberry PI achivements and news

Raspberry Pi won another award for innovation of the year at stuff gadgets 2012, which I think is great as Raspberry Pi lets the users do  so much which lets them use their own innovation.

Picade is using Raspberry Pi to create a mini desktop arcade game, with a real joy stick and buttons with a solid carbonate case. I think this is great as people can play classic games such a Pac-Man on a classic arcade style platform.

Raspberry Pi is being used in schools using censors monitors and lights including programming, and also students are enjoying using Raspberry Pi’s. I think this is a good idea to use them in schools as students can learn different things such as programming.