Jump to content

Recommended Posts

Posted
I have an 8 soon to be 9 year old who is taking an interest in gadgets. Now I want to encourage this, but I also want him to be able to actually learn more about the technology and how it works etc. Anyone got any advice, experience of things they were able to do to encourage their kids? The kids have an old laptop so if there is any free/cheap software able to run on an old laptop I could install that
Posted
We've gone a bit more physical with my 9yo - standalone robot kit, robotic arm kit that we can then control with a scratch addon, Raspi with a sense hat, waveshare gamehat for raspi with Retropie, stripping down an old device from work to see all the components, build your own radio controlled boat out of plastic bottles kit etc.
  • Thanks 1
Posted
My first thought was a Raspberry Pi or Arduino with one of the kits you can get to have lots of things to do with it. One of the books that give projects and ideas for them to work through (Evil Genius one is pretty good)
  • Thanks 1
Posted
The kids have an old laptop so if there is any free/cheap software able to run on an old laptop I could install that

 

Sold on Amazon as "customisable USB foot pedals", these (£15) and similar are good fun:

 

https://www.amazon.co.uk/Tiardey-Optical-Control-Computer-Keyboard/dp/B09TQFBS3C/ref=sr_1_5

 

It's a button you can program to emulate any key ("A", "B", "1", etc - I think you can even have it do strings of keypresses), and it works as a standard keyboard without drivers, so you can use it as an input device on the Pi or similar, or for something running a web browser. They are sold as foot pedals, so are quite robust and should be able to put up with a reasonable amount of excited thumping. You can, of course, have multiple buttons.

Posted
I have an old Raspi. I will take a look to see if there is something I can do with that. I am not sure he is able to hold attention for long so it needs to be something quick and easy. But at least I don't have to spend money on that
Posted
I have an old Raspi. I will take a look to see if there is something I can do with that. I am not sure he is able to hold attention for long so it needs to be something quick and easy. But at least I don't have to spend money on that

 

We've found the sense hat to be really useful with scratch because it's so immediate, you click something on the screen, something lights up, you shake something values change. Our favourite has been a cookie clicker game using the joystick made in scratch and a snake game initially using the joystick, but eventually modified to using the gyros so you tilt the whole Pi to direct the snake in Python.

 

Snake game basic code:

 

from sense_hat import SenseHat
from time import sleep
import random

sense = SenseHat()
sense.low_light = True

GREEN = (0, 255, 0)
RED = (255, 0, 0)
YELLOW = (255, 255, 0)
START_DELAY = 3
MATRIX_MIN_VALUE = 0
MATRIX_MAX_VALUE = 7
MATRIX_SIZE = 8

while True:
   gameOverFlag = False
   growSnakeFlag = False
   generateRandomFoodFlag = False
   snakeMovementDelay = 0.5
   snakeMovementDelayDecrease = -0.02
   score = 0

   sense.clear()
   sense.show_message("SNAKE GAME")

   # Set default snake starting position (values are chosen by preference)
   snakePosX = [3]
   snakePosY = [6]

   # Generate random food position
   while True:
       foodPosX = random.randint(0, 7)
       foodPosY = random.randint(0, 7)
       if foodPosX != snakePosX[0] or foodPosY != snakePosY[0]:
           break

   # Set default snake starting direction (values are chosen by preference)
   movementX = 0
   movementY = -1

   while not gameOverFlag:
       # Check if snake eats food
       if foodPosX == snakePosX[0] and foodPosY == snakePosY[0]:
           growSnakeFlag = True
           generateRandomFoodFlag = True
           snakeMovementDelay += snakeMovementDelayDecrease
           score = score + 1

       # Check if snake bites itself
       for i in range(1, len(snakePosX)):
           if snakePosX[i] == snakePosX[0] and snakePosY[i] == snakePosY[0]:
               gameOverFlag = True

       # Check if game-over
       if gameOverFlag:
           break

       # Check joystick events
       for event in sense.stick.get_events():
           if event.direction == "left" and movementX != 1:
               movementX = -1
               movementY = 0
           elif event.direction == "right" and movementX != -1:
               movementX = 1
               movementY = 0
           elif event.direction == "up" and movementY != 1:
               movementY = -1
               movementX = 0
           elif event.direction == "down" and movementY != -1:
               movementY = 1
               movementX = 0

       # Grow snake
       if growSnakeFlag:
           growSnakeFlag = False
           snakePosX.append(0)
           snakePosY.append(0)

       # Move snake
       for i in range((len(snakePosX) - 1), 0, -1):
           snakePosX[i] = snakePosX[i - 1]
           snakePosY[i] = snakePosY[i - 1]

       snakePosX[0] += movementX
       snakePosY[0] += movementY

       # Check game borders
       if snakePosX[0] > MATRIX_MAX_VALUE:
           snakePosX[0] -= MATRIX_SIZE
       elif snakePosX[0] < MATRIX_MIN_VALUE:
           snakePosX[0] += MATRIX_SIZE
       if snakePosY[0] > MATRIX_MAX_VALUE:
           snakePosY[0] -= MATRIX_SIZE
       elif snakePosY[0] < MATRIX_MIN_VALUE:
           snakePosY[0] += MATRIX_SIZE

       # Spawn random food
       if generateRandomFoodFlag:
           generateRandomFoodFlag = False
           retryFlag = True
           while retryFlag:
               foodPosX = random.randint(0, 7)
               foodPosY = random.randint(0, 7)
               retryFlag = False
               for x, y in zip(snakePosX, snakePosY):
                   if x == foodPosX and y == foodPosY:
                       retryFlag = True
                       break

       # Update matrix
       sense.clear()
       sense.set_pixel(foodPosX, foodPosY, RED)
       for x, y in zip(snakePosX, snakePosY):
           sense.set_pixel(x, y, GREEN)

       # Snake speed (game loop delay)
       sleep(snakeMovementDelay)

   # Blink the dead snake
   for loop in range (5):
       sense.clear()
       sense.set_pixel(foodPosX, foodPosY, RED)
       for x, y in zip(snakePosX, snakePosY):
           sense.set_pixel(x, y, RED)
       sleep(0.5)
       
       sense.clear()
       sense.set_pixel(foodPosX, foodPosY, RED)
       for x, y in zip(snakePosX, snakePosY):
           sense.set_pixel(x, y, GREEN)
       sleep(0.5)

   sense.clear()

   # Display score
   while score:
       sense.show_message("Score: {}".format(score), text_colour=YELLOW)
       # Press joystick middle button to play again
       for event in sense.stick.get_events():
           if event.direction == "middle":
               score = 0

 

from: cytron.io

  • Thanks 2
Posted
using the gyros so you tilt the whole Pi to direct the snake in Python.

 

Ooh - strap the Pi to the underside of a bit of wood, stick some springs on the side and make a tilt-able platform you can stand on to control the game...

  • Thanks 2
Posted
I haven't yet. I looked on the bundles provided in a link here and there looks like some interesting stuff. One of the things I thought would be good is the outside camera. But I am reluctant to spend 100 if I can repurpose my old first gen Raspi. But I need to create some time to see what bits I have hanging around and see if he would really be interested. I already asked him and he seemed interested. But honestly, I think the best option in his opinion would be the retro game console....but we already have a Nintendo so I'm not interested in doing that. We need to find a compromise...but he struggles with keeping attention also so I'm going to go slowly
Posted
One of the things I thought would be good is the outside camera.

 

You could try a cheap (£20) USB microscope camera:

 

https://www.amazon.co.uk/Jiusion-Magnification-Endoscope-Microscope-Compatible/dp/B07DRGR6LX/ref=sr_1_1_sspa?th=1

 

Looks like it should just plug into any computer (including your Raspberry Pi) as a generic USB camera, and it's the sort of thing you can try pointing at different stuff around the house / garden.

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...