Sunday, 28 June 2015

Week 5 (23rd June)

Scratchers 

Scratcher this week worked on the "when sprint clicked" EVENT, shown in Figure 1.
Figure 1:  When this sprite clicked block from the EVENTS block.
The idea was to combine some random action based on last weeks activity with some action such as a "hide" (from the LOOKS block) which should occur when a mouse button is pressed while over the sprite.  Scratchers should watch out for funny effects such as the action not working sometimes.  This can happen if the sprite is busy doing some other complex activity, such as gliding over a time T-seconds.  In such a case, you need to wait for T-seconds before you can click on the sprite.

Gurus  


Gurus continue to work on their primary games.  Many students are close to finishing PONG, but as a Guru, you need to make sure it is really working perfectly.  If there are any weird effects you can't understand talk to me, or another Guru or Apper.  This week we started the mentor program, where 3-Guru's are assigned to work with the Scratchers.  We will select 3 different Guru's each week to work with the Scratchers, as this helps the Guru's refine their skills and helps the Scratchers overcome some stumbling blocks.

Appers

Appers had a different activity this week as described below.  They needed to create an animated GIF by following these steps.
1)      Create some slides in power point of an image.  In each slide, make the picture only slightly different from the previous so that when you flick through the slides, it looks like a  simple animation.
2)      Save the document as a power point file (myfile.pptx).  Then use the “Save As” button and select the “Save as type” as a GIF file (or JPG or PNG)- see Figure 2.

Figure 2: Select the "Save as Type" in powerpoint to a GIF (or PNG)


3)      It will then ask the question shown in Figure 3:
Figure 3:Which slides to export Dialog box











4)
      Select “All slides”  This will save every slide in the document to a folder with each slide given a different name.
5) Now go to : http://gifmaker.me/  which will bring you to the screen shown in Figure 4.
Figure 4:  The GIFMAKER main screen
6) Upload you images (all the slides created)
7) Then select the Animation speed to the right
8) Then click “Create GIF animation”
9) Download the resultant GIF.


When you click on this gif it should now run in a browser and be animated.
Activity: 
Check the file size of GIFMAKER.  It’s good to make the GIF files very small to reduce the time it takes to load.

Adjust the “Image size” number of pixels on the right and repeat the above, checking out the effect on the file size when you download it again.
You can now use this GIF as an icon or avatar. 
Here's an example of my snowflake animation that I use for my Scratch ICON.  This file is only 15kbytes in size.

Saturday, 20 June 2015

Week 4(16th June)

Scratchers:  

This week the Scratchers experimented with random numbers.  In Scratch we can create random numbers using the [pick random {lower num} to {upper num}] block - see figure 1.  This block can be found under the OPERATORS tab
Figure 1:  Random block in scratch found under the OPERATORS tab

Scratcher are excouraged to experiment with using random numbers to add some unpredictability to their programs, as they would find in real games.  For instance, you could move around the screen to random locations as part of a "find and click" game.  Try the block shown in Figure 2 for example.  Note the range I have used for the random numbers.  Refer to week 2 where we discussed how to move around the screen.  In that week we used an x-direction number line (left-right) and a y-direction number line (up-down).  Check to see you understand how large positive and how large negative the x and y number line values can be 
Figure 2: Using random to move around the entire screen
Or maybe you just want your sprite to randomly do one thing or another...like changing costume.  You can use the [if then else]  block we learnt about in week 3.  Try out the code block below (use the cat sprite to ensure you have at least 2 costumes).  The result of this code block is shown in figure 4.
Figure 3:  Random selection of 1 or 2 options (changing costume)
Figure 4:  Result of the random costume changing cat

Gurus:

Figure 5:  Block that results in reflection
of the sprite from each of the 4 walls. 
This week the Gurus helped to take apart an old tower desktop computer.  The students had to identify the hard drive, the memory and the central processing unit (CPU).  Many students made a simple sketch of the motherboard.  If anyone has a sketch they can scan and post from the session, it would be great to see.
Many of the Guru's are having an issue with the return bounce of the ball off the bat or walls in the game of PONG.  This is a reflection-off-a-surface problem.  The ball should come off the wall at the same angle the ball struck the wall.  There is a  detailed block-segment and explanation from the Scratch Wiki, however the math is difficult to appreciate for primary students.  Still the block works fine to use.  Another method uses broadcasts which will not be covered for a few weeks for the Scratchers.  A simpler (maybe) method is shown in the block I created in Figure 5, with the resulting output from this block shown in Figure 6.
Figure 6: Animated sprite reflecting off each
of the 4 walls
From next week 2-3 of the Guru's will be selected each week to help out the Scratchers.  This peer learning is a really effective way for the Scratchers to learn and for the Guru's to improve their own understanding and get recognized for the skills they have already developed. 

Appers:

Network issues are still delaying the Appers from being more productive, but they're in there each week programming away and helping the Guru's develop their skills.  Many thanks to the Appers for their patience and the tech-savvy parents helping to solve the issues.

Old Laptops for Kids

Some parents are interested in using older laptops for their children to experiment with programming and Scratch.  I highly suggest using Puppy (follow the link).  It has a very small installation size so can fit on older laptops/desktops with lower capacity hard drives.  If you're just running a browser and scratch with no intensive video or graphics, this is a simple option for you.

Wednesday, 10 June 2015

Week 3(June 9th) Activities

Week 3


Figure 1: <if> -<then>-<else> block in Scratch
This week we looked at the <if> -<then>-<else> block in Scratch.  This block is shown in Figure 1.
 The <if> portion requires a question to be asked with a yes or no answer.  Based on the answer, the block would do one function or <else> it would do another. We ran a simple activity to show this to the students.  I tapped each student on the head and asked "Do you have brown hair ?".  If the answer was "yes" the student went to the left and waved their arms, if the answer was "no" the student would go the the right and jump up and down.  At the end we had sorted all the students with brown hair into a hand waving frenzy, with non-browns jumping.

The activity for the "SCRATCHERs" this week was to use the <if> -<then>-<else> block in Scratch to perform some simple function.  As well, the students need to continue with the next tutorial in Scratch and save each tutorial when completed.
The "GURUs" need to continue with their game, being careful to obey the rules of pong as closely as possible (scoring, realistic ball motion and bounce from bats, ball reset to the center when the point is lost).
The "APPERs" are still having connection issues between the school computers and the tablets using the MIT App inventor, so until resolved we have started them looking at Arduino in Scratch, by controlling an LED, speaker and servo connected to a simple robot.  Details of the activity and installation required can be found here (setup by some vacation students I had in 2014).

Keep programming and save your results



Week 2 (2nd June) Activities

Week 2 (2nd June)

Figure 1: Simple number line starting from 0
This week we reviewed the basics of the number line.  Most students at year 3 level are used to the number line starting at zero and going to infinity, as shown in Figure 1.

Figure 2: number line going from minus infinity to positive infinity
However in practice the number line can extend just as far to the left, and to show this we use negative numbers, as shown in Figure 2.  
Figure 3: x-axis numberline in Scratch going from -240 to +240, with 0 in the middle
We can use this number line concept to move objects around the screen in Scratch.  but infinity is a pretty big number and our screen has only 240 spots (or pixels) to the right of zero and 240 pixels to the left of zero.  We call this the x-axis and this is shown in Figure 3.

Figure 4: x and y axis combined 
Now if we turn this number line so that it points up and down, with positive numbers going up we still have a number line.  We call this the y-axis and these numbers in Scratch have 180 pixels above zero and 180 pixels below zero.  We can combine both x-axis and y-axis as shown in Figure 4.  In mathematics, this is called the xy-Cartesian axis.  To put an object at the top right location, you would set the x=240 and y=180, and we right this as (240,180) or (x,y) where x comes first, then y.
To help move objects around the screen in Scratch, you can use the xy-grid backdrop in Sratch, which is shown in Figure 6.  This really helps to figure out the (x,y) location on the screen where you want your sprite to go.
Figure 5: xy grid backdrop available in Scrtach
In Week 2, students should practice using the "GLIDE" command in scratch to move a Sprite around the screen, going from each corner to each other corner by specifying the (x,y) locations to glide to.







Tuesday, 26 May 2015

The computer club started in fine form today, the first Club meeting for 2015 (Term 2).  Thanks to the large array of parents who turned up in support. Hopefully you appreciate the need for parent supervision as it's a bit hectic -- largely due to the enthusiasm of the kids and their excitement to show what they have done or to get started in a new programming career.  Some comments:
  • The students starting out on Scratch are being called "SCRATCHERS" (25 at the first meeting).  These students are largely beginning on Scratch for the first time and are based in the library.  For this week these students need to complete the "Getting Started with Scratch" (first tutorial) on Scratch and setup an account (with the help of a parent) so that they can save their work. Saving the work is essential for us to view and note down so that children can move onto the next activity. Just click the Join button at the top of the Scratch Screen and you should see the screen to the right - follow the steps to create an account.   I have sent home a practice card for these students to try.  Students will get a new card each week until they complete the set (of 12).  For those following along at home, follow the links to catch up or advance..
  • The students with some Scratch experience are being called "GURUs" and are based in the computer Lab (14 of these students at the first meeting) .  These students will need to complete, and be able to explain, 3 programs in Scratch.  The game of PONG, a RACING car game and CONNECT4.  Once done they can migrate to being "APPers".  So focus on getting the games to work as best you can (don't settle for 'almost' correct.... the devil is in the detail).
  • The experienced Scratch programmers will be called "APPers" also based in the computer lab. These students will focus on designing an App on the School supplied Tablets (Android).    These students will be using MIT App Inventor and will need a Google Account in order to save their work and continue (if desired) from home.  Currently we have 2 "Appers".   I have this crazy idea about the kids developing an App for the upcoming Fete, to tell everyone where and what stalls there are, but I may be aiming too high.
Remind your children than any Scratch/App development screen time should be taken out of their weekly allocated screen time (TV, Gaming, MineCraft etc..)..  Please ensure all children have a Scratch login account as his allows them to save their work. They cannot move onto the next activity until we see and tick off their completion of each task.

We are well over subscribed with students which risks the quality of the experience for all those attending.  So we can't consider any additional students this year.  But follow along online and you'll be a a good position to join next year.
More next week.


Saturday, 22 November 2014

Super-Animal Soundcard. Make your own sounds !!

Summary: This post discusses a simple,inexpensive Sound Card that reads bar codes and is used to generate animal sounds from animal-trading cards provided through our local supermarket chain. The post shows how you can make your own bar codes to create the sounds without (or in addition to) the cards.

Intro:  Collectable cards are a favorite again (right).
Our local supermarket giant (Woolworths) has started giving away cards with purchases above a certain value.  Theses card have animal pictures, names, a "did you know ?" question and Question/Ans section.

A nice feature of these cards is they have a bar code on the back (see image below).  With a purchased card reader (AUD$6) the card reader makes the animal sound associated with the animal when the bar code is swiped through the reader.
Super-Animal card & Soundcard Reader


Our idea was, could we get the Sound Card to make a sound of an animal from a bar code that we created ?  We started by looking at all the bar codes lined up as shown below.  The bar codes all show a very similar pattern (try it if you have your own cards).  There are 13 bar code lines over a distance of 52 mm, so that the spacing between each line (called the pitch) is 4mm. 

 The first 3 lines are always very thin and the last  line is always fat.  These are typically referred to as START bits and STOP bits.  Combinations of thin and fat lines in between the start and stop bits tell the Sound Card what sound to play.  We started by using a black sharpie pen (from any stationary store or newsagent) to draw lines on thick card stock (around 220 gsm).  Thin paper generally doesn't work (see later for explanation).  If your very careful, you can get hand drawn lines to work, but the lines must be drawn very carefully.  Start by trying to copy the lines of an existing card that you have.  Some of our examples are below.

 We found it hard to make sounds consistently (all the time) with hand drawn lines.  So we created a template which you can download and print on thick card stock (~200gsm, again available from stationary stores an some newsagents).  Be sure when printing that you do not select "Fit to page".  You must print the original size of the bar code pitch will change.  When we used this template to create new bar codes, the results were much better. 

Things to try:  Randomly make some of the lines thicker between the start bit (3 first thin lines) and stop bit (thicker line on the end).  If it makes a sound, then try to find the corresponding card from your collection.  BETTER STILL, we'd love to hear from any one who has found a bar code that makes a sound  that does not belong to any card !  Some software programmers often put these special bonuses into their programs and call them "Easter Eggs".  They are most often found on CD's or DVDs, but I'm interested to know if there is an Easter Egg on the Sound Card reader.
Template for creating your own bar codes (use the pdf provided).  The bar codes must be printed on thick (200gsm) card stock to activate the switch in the Sound Card (see How it Works below).  The template contains the correct spacing of lines. Tthe 3 start line and stop line should not be altered when you make your own.

How it works 

The image below shows a card in the Sound Card reader, with the back of the Sound Card open. 
Figure:  Center - Opened Sound Card showing the on/off switch and bar code Sensor (operational detailed in image below).  To the left, larger image of the Switch and Bar code sensor, To the Right - larger image of the memory chip containing all the sounds.
As the card passes down the reader, it presses against a micro-ON/OFF switch (see below in more detail).  This turns the Sound Card on only when the card slides down the reader, and means that the batteries are not wasted when the Sound Card is not being used.  It's also the reason you need to use thick card stock (200gsm) for the bar code paper, as  regular paper is too light and will not push hard enough on the switch to turn it on.  After the micro-switch turns the Sound Card on, the bar code passes by a Bar Code Sensor.

 This Bar Code Sensor consists of a light source (called an LED which stands for light emitting diode) and a light source detector.  The LED emits infrared light (IR=infrared).  The IR light is invisible to your eyes but some cameras can see this light - ask your parent/guardian to try using their phone camera to see the light just as the card passes the sensor (it's a very weak light).  Also use the phone to see if your TV remote control is working (they use the same wavelengths) - i-phones may not work to view this light as some use a filter to block this wavelength of light.  An illustration of how the bar code sensor works is shown below [Source].  When the IR light (from the LED) passes by a white section of the card, the detector sees the reflected light and reads this information as the code "1".  When the light strikes the black portion of the card, no light is bounced off the card, so the detector sees no light, and reads this as a "0". 
Source: http://abhitechstrong.blogspot.com.au/2013/01/basic-electronics-project-5-making-ir.html
Figure : Illustration of the LED (IR transmitter) and detector (IR receiver).  IR stands for Infrared and means that you can't see this light with your eyes (however some digital cameras can see this light) - Image Source
    So when the whole card is swiped past the Bar Code Sensor in the Sound Card it reads a code like 11101101001100101011111.  It then looks this code up in a list (often called a database) where it finds the correct sound for the animal.  An example list I made up is shown to the left (the codes are not correct). Using the code the brains in the Sound Card looks up and finds the correct animal/Sound from the list and then plays that sound. 
In the figure above which shows the opened Sound Card, the brains of the Sound Card (a small microcontroller) is covered up by this blob of black goop.  Manufacturers use this goop to cover up he part numbers to reduce the chance of someone reverse engineering the technology.  Actually, all the sounds (stored in the database) will be stored in the 8-pin chip (25L1605D) shown on the right of the image above (next to the opened Sound Card).  This is a 16M-Bit CMOS serial flash (technical datasheet).

 Let me know if you find any easter eggs using your own bar codes, or if you have any ideas on how you might use this Sound Card differently.  A great learning experience for AUD$6.  Please ask a parent or guardian before doing anything like taking the Sound Card apart.

NEWSFLASH:  We've recently found that Card #15 (Grater One-Horned Rhinoceros) makes what we think is a bird sound and the Southern Cassowary (Card #33) makes a grunting sound.  Did Woolworths mix these two sounds up in the soundcard reader (market name SoundKard) internal data base ? I suggest checking other cards for inconsistencies otherwise you or your children could grow up with a very distorted view of how animals sound.!!  Let me know if you find any other errors in these cards.

Adrian





Monday, 4 August 2014

New term -6&7s

Last term I was very impressed by the years 3-5 efforts in Scratch with one student able to  to talk to an Arduino. This term the yeas 6&7s have blow me away with both their enthusiasum and their ability to quickly learn the basics of Scratch.  At least 2 students have moved straight onto programming Arduinos.  We are using a computer club book to keep track of each weeks tasks and what each student has completed.  This will help me as well as the students look back and see how much they have learnt.  It also keeps a record of the tricks they have learnt to solve complex problems.  Please ensure you work at this a little bit each week to develop your skills.

This week's task which I pasted into the Student Journal is to create the game of PONG.  The assignement is:

  1. Cretae a ball (centered) and 2 blocks on the left and right  to use as bats (example shown)
  2. Start the ball moving left to right when the space bar is pressed. If the ball does not hit your block, then the ball is lost off screen. Move left block up/down using [Q,Z] keys,move right bat up/down using [up arrow, down arrow].

Extra things to do:

  1. Add a score – you get a point in the other player misses
  2. stop the blocks (bats) moving off then screen when moving up and down.
  3. Add a random angle to the ball after it hits the bat to add difficulty to the game
  4. When the ball strikes the bat, make sound “pop” and return the ball (like tennis).
  5. Change service (ball goes in the other direction when space bar is hit) if you loose (miss the ball)