TeCoEd (Teaching Computing Education)
  • Home
    • Freelance
    • Book
    • Downloading
  • Python
    • Learn Python >
      • Python Modules
    • PyGame Zero
    • Python Programs >
      • Higher or Lower
      • Magic Calculator
      • Password Checker
      • Python Pit
    • What's News App
    • Pixels to Cells
    • Python Mosaics
    • Python OCR
    • L-1-AM
    • Web Scraping >
      • Scraping Trains
    • Weather App
    • Snakes and Windows
    • Python Web Server >
      • Flask
    • Python Picks
  • Raspberry Pi
    • All About the Pi
    • Getting Started
    • Remote Desktop and VNC
    • Static IP Address
    • Sonic Pi >
      • 3.14
    • Twitter Feed >
      • Tweepy
    • Android & Pi >
      • Advanced Apps
      • Odds
    • A.I on the the Pi
    • CRON
    • Pick Your Own
  • Pi Hardware
    • Pi HATS >
      • Sense Hat Hacks
      • AstroPi HAT
      • Unicorn-HAT >
        • Unicorn Alphabet Disco
        • Uni Codes / Programs
      • Skywriter
      • Piano HAT
    • STS Pi
    • Pi Camera >
      • Pi-Cam, Python & Email >
        • Time Lapse
      • Pi Noir
    • Pipsta >
      • Flask, Input & Printers
    • Raspberry Pi Power >
      • Energenie IR power
    • Pibrella
    • Distance Sensor
    • LCD Screen
    • Pi-Tooth
    • Robot Arm
    • PiGlow
    • PiFM
    • Accelerometer
    • PiFace >
      • Installing PiFace >
        • Python Commands
  • Pi-Hacks
    • Drone Hacks
    • Pi Glue Gun Hack
    • Blinkt!
    • Sonic Pixels
    • R2D2
    • Get to the chopper
    • Astro Bird
    • Twitter Translator
    • Hacking a Robot
    • Nature_Box >
      • Best Nature Photos
    • Wearable Tech >
      • Project New York
      • P.N.Y Part 2 Health
      • P.N.Y Part 3 Games
      • P.N.Y Part 4 Translation
    • Dino-Tweet
    • Other Links
  • Pi-Hacks 2
    • The Joker
    • Hologram Machine
    • Google Vision: Camera Tell
    • Yoda Tweets
    • Pi Phone
    • Darth Beats
    • Twitter Keyword Finder
    • Crimbo Lights Hack
    • Xmas Elf
    • Halloween 2016
    • Halloween Hack 2015
    • Socrative Zombie
    • Voice Translation
    • The Blue-Who Finder
    • GPIO, Twitter
    • Pi Chat Bot >
      • Dictionary Definitions
    • PiGlow & Email
    • Pibrella Alarm System
    • SMS with Python >
      • Spooking a Mobile
  • Pi-Hacks 3
    • David Bowie
    • Lamp Prank >
      • TEST
    • Yoda FM
    • Retro Player
    • LED Pixel Art
    • TARDIS
    • Battleships
    • LED Board
    • Night Vision
    • Enviro+ Weather
  • Minecraft
    • Minecraft API
    • Minecraft Sweeper
    • PiGlove: Minecraft Power Up
    • Minecraft Photo-booth
    • Rendering Pixels
    • Speed Cube
    • Lucky Dip
  • Computing
    • Why Computing?
    • Can You Compute
    • micro:bit
    • Coding Resources
    • Learn to Code >
      • Coding with iPads
      • Apps Creation Tools
      • sKratchInn
      • Sound Editing
    • Cheat Sheets
    • Theory
    • HOUR OF CODING
    • BEBRAS Computing Challange
    • Computer Facts
    • Free Software and Links
  • Contact Me

Hack 1: Binary Twitter Hack


Binary is the basic language of a computer.  Values that can be stored and then manipulated or converted into a new value.  This value can then be interpreted into sound, letters, pictures and many other elements.  In GCSE Computing students learn how Binary is used to represent letters and characters, I wanted them to be able to see this in action in an inspiring way.  Using the Sense HAT and Twitter I have created a program which retrieves a tweet from my timeline.  It then uses the Python codeline:   word = bin(int(binascii.hexlify(Tweet), 16))  
​

This line converts each letter in the tweet into a binary value.  Then the value, either 1 or O is displayed on the Sense HAT’s LED matrix.  Each tweet is converted into a Binary representation of the message.
Picture

In Action



Hack 2: R.P.S.L.S


Picture
You will know that Rock-paper-scissors is a hand game usually played between two people, in which each player simultaneously forms one of three shapes with an outstretched hand. These shapes are "rock" (a simple fist), "paper" (a flat hand), and "scissors" (a fi_st with the index and middle fingers together forming a V). The issue is that the game has only three possible outcomes other than a tie which means it is very easy to predict or guess your opponents hand.  This where the new game comes in, "rock-paper-scissors-Spock-lizard", invented by Sam Kass and Karen Bryla. This version adds "Spock" and "lizard" to the standard three choices. "Spock" is signified with the Star Trek Vulcan salute, while "lizard" is shown by forming the hand into a sock-puppet-like mouth. Spock smashes scissors and vaporizes rock; he is poisoned by lizard and is disproved by paper. Lizard poisons Spock and eats paper; it is crushed by rock and decapitated by scissor making the game more exciting, random and stimulating!
​
You can play a version for yourself which I coded in Python, the real hack is adapting the code and using the SenseHAT hardware to add the new features and make the overall experience more interactive.  PyGame was used to add joystick controls to enbale the player to make a selection, spock, lizrd etc.  Messages atre scrolled to update the player on the game and who has won, the computer or the player.  Final I used SenseHAT Paint and 8x8GridDraw to create the LED images for the game.   Watch the videos below to learnt the rules and see the RPSLS in action, then download the code and have a go yourself.

Play the Game



Hack 3: RGB 255


Picture
Many of my students ask how can three colours be combined to produce so many other colours?  The SenseHat’s LED Matrix boasts 64 LEDs which can each show over 16 million colours, but how?  How does it work? 
​

Each single LED is made up of three smaller Red, Green and Blue elements which can be coded to display up to 255 different shades. That is 255 shades of Red, a zero value gives you no red! so no colour, 255 shades of Green and 255 shade of Blue too.  So, how do you get over 16 million colours?   Well, the maths is simple, 255 x 255 x255 which is 16581375 combinations.

What better way to show this than to use the SenseHat and some Python code to calculate each colour and display it on the LEDs. But, the real question is how long do you think it takes to cycle through and to display all the colours?  Download the code and try it for yourself -  you may need some time off of work or school!

16581375 Shades of Not Grey



Hack 4: Egg Drop


Picture
​Egg Drop is a simple game where eggs fall from the sky, well from the top of the Sense HAT. The eggs fall toward the ground under the influence of gravity!  You have a basket which you can use to catch these eggs.

If you catch one, then you gain one point and your score goes up. Welcome to round two. A new egg now drops from a random position at the top of the SenseHat.  To control your basket, tilt your Sense HAT left or right which will measure the change in the axis and move the basket.

However, if you miss the egg then the it’s ‘Game Over’ and you have to start again.

​Now download it and try and get a high score!

​Gotta Catch Them All!



Hack 5: MP3 Player


The AWESOME MP3PLAYER created and coded with three excellent students. It features the following:

Selecting a Song:  Use the joystick to move around the blue area, you will see the letter for each song displayed.   Adjust the Volume:  Now that the song is playing you can adjust the volume by moving to the green dot and pressing the joystick in, Enter.  Look for the ‘#’ symbol.  
 
Reset button:  The orange button is located at the bottom right row, second from the end.  This button is identified by the ‘@’ symbol.  End: The red dot displayed with the ‘%’ symbol ends the program, navigate to the positon and press Enter on the joystick.  The program ends
 
Moods :  Within the MP3 player are four ‘mood’ playlists, identified by the teal LEDs.  Scroll down to and hover over one.  The ‘mood’ number will be displayed.   Thinking, Relaxing, ISS Party and Bowie Tribute.  Playlist: There are also four ‘genre’ playlists, identified by the yellow LEDs.  The playlists are as follows:  Rock, Rap / RnB,  Space and Sonic Pi winners.
 
Instructions:  The white dot is the instruction button, this displays a letter ‘i’.  Select and you will be treated to a guided tour of the MP3s features.

Students Discuss What They Made


Picture

Hack 6: Battleships in Action


SenseHAT Battleships


The classic game of Battleships on the Raspberry Pi SenseHAT.  The program creates a random layout of boats, ammo and water.  Use the joystick to select a location and then press Enter to fire a Torpedo.

If you miss you will here a splash of water, if you hit then you will hear the explosion.  Else you may find an ammo dump.  Each square is then coloured, blue for water, red for a ship and yellow for ammo.  You will be updated n the number of ships left to destroy.

When you have used all your Torpedoes up or you have destroyed all the ships, then game ends and you are updated with your score.  You can select to play again and a new random layout is created, or leave the game.
Picture
Copyright 2021 TeCoEd @dan_aldred