Explorers Week 9 – Paint Program

Hi everybody,

Hope you all enjoyed finishing up our drawing program. We made good use of costumes this week to make it look like we were dipping our paint brush in each of the different colours.

We also used a variable similarly to how we used in the Piano Game we made. We made it into a slider and then code select the Pen Size we wanted.

Here are the notes in PDF. CDA-S6-Week_08-Paint

See you next week for something a little Christmas themed!

 

Martha

 

Hackers – a Joule Thief and Controlling Motors

DSC_2299

In the Hackers group, people worked on two different projects, making a Joule Thief and controlling motors.

Joule Thief

A Joule Thief is a small circuit that can boost the voltage from a small power source. Typically, it is used to power a 3-volt LED from a 1.5 volt battery. Because of how it works, it can continue to light the LED even when the battery would usually be considered to be “out of power”, when its voltage drops below 1v.

Here is a Wikipedia article. https://en.wikipedia.org/wiki/Joule_thief

people in the group found various tutorials online, such as this one from Make Magazine: https://makezine.com/projects/joule-thief-battery-charger/

Motor Control with an Arduino

Continuing our work on Project SABRE, we were figuring out how to control motors.

A simple way to control the speed of a motor is to regulate its input voltage. In Arduino code, you set the output voltage of pins. However, you CANNOT just hook them up to the motor, as it will draw too much current and damage the Arduino.

The solution is to use a transistor: power from a 9V battery or the 5V USB power supply from an Arduino powers the motor with current flowing through the transistor, and we regulate the current flow by applying an appropriate voltage to the middle leg of the transistor.

Two more components are needed: a resistor for the middle leg of the transistor, and a diode to get rid of any voltage spikes that come from the motor acting as a generator if it us spun by hand, or when it is spinning down after current to it is cut.

More details here: https://learn.adafruit.com/adafruit-arduino-lesson-13-dc-motors/arduino-code

We also looked into stepper motors, and controlling speed by reading a value from a potentiometer, instead of just typing in a speed: https://www.arduino.cc/en/Tutorial/StepperSpeedControl

 

Brilliant Visit by Medtronic to CoderDojo Athenry!

This slideshow requires JavaScript.

We were delighted to have Medtronic visit us on 18 Nov 2017 at CoderDojo Athenry. It really was a fantastic event, and very professionally organised by Cushla, Mary and the rest of the team from Medtronic, who gave out different-coloured wrist-bands to divide our large ninjas into groups who could view the demos together.

The team set up a great range of demos:

  • A special “memory” metal they use to make stents for heart valves
  • A Smart TV/Surface Pro to allow you to see how stents work
  • VR Headsets to explore blood vessels in augmented reality 
  • Some experiments that you can try out at home, including how to make a stethoscope and how to make a valve like a heart valve.

In addition, senior software engineer Lorraine and software interns Patrick and David spoke about their experiences of being software engineers in the med-tech industry.

We are very grateful to Medtronic, and in particular our mentor Declan Fox, for organising such a great experience for our ninjas!

Explorers Week 8 – Making a Start on a Paint Program

Hi everybody,

No notes this week, I will wait until we complete the game this Saturday.

Hope you all enjoyed the visit from Medtronic, we really appreciate the volunteers coming out to see us and showing us all the really interesting and exciting things they do….and the lollipops were lovely too.

See you all next week and we will complete our Painting program

Martha

 

Creators – Arrays and Classes

Several Values in One Place

This week we looked at two very useful concepts in JavaScript, Arrays (we’ve also called them lists) and Classes (we’ve also called them objects). They are both things that allow one variable to store more than one value at at time. This can often be very convenient and has the potential to save us a lot of typing! Who doesn’t like that?

Arrays

A plain variable in JavaScript can store a single value, we’ve seen that loads of times:

let a = 5;
let b = 7;
let c = a + b; // will be 5 + 7 = 12

An array variable in JavaScript can store more than one value, just by putting them in square brackets and separating them with commas:

let a = [5, 7]
let c = a[0] + a[1]; // This is the same as above!

The code here does the exactly the same thing as the block above it. See that a now has two values in it and we use a[0] to get the first value and a[1] to get the second. This technique isn’t super useful when we only have two values, but the more we have to store, the more useful this gets. Imagine if we had 10 values,  how much shorter would the array version be?

You can also create an empty array and put values in it later:

let a = [];
a.push(5);
a.push(7);

In the code above we create an empty array (nothing between the square brackets) and then use the push() function to add two values into it.

Concept of Classes

A class is a programming concept that lets you define objects which contain both Properties and Methods. Properties are values associated with the object. Methods are actions that we can ask the object to perform.

class

Think of yourself as a Person object and imagine some of the Properties and Methods you might have.

Your Properties might include NameAgeHeightWeight, etc. A simple Method you might have could be SayHi(). That would make you say “Hi, it’s <Name>!”.

A method might have arguments, so it could be SayHiTo(“Dave”) which would make you say “Hi Dave!”.

Classes in JavaScript

Making classes in JavaScript is pretty easy. Let’s look at the Person class we showed above:

class Person{
  constructor(name, age, height, weight){
   this.Name = name; 
   this.Age = age; 
   this.Height = height; 
   this.Weight = weight;
  }
  
  SayHi(){
    Console.Log("Hi, it's " + this.Name + "!");
  }

  SayHi(who){
     Console.Log("Hi " + who + "!" );
  }
}

We say “class“, the name of the class and a pair of curly brackets. Inside these brackets we have three functions (but notice we don’t have to say “function“).

Let’s look at the first of these, called constructor(). This is where we set the class properties. Note that we must put “this.” before properties to distinguish them.

The second two functions, SayHi() and SayHiTo() aren’t too usual, again note that we must use “this.Name” to get the value of the name property.

Download

This week we created a class to represent a bouncing ball and we saw how easy it was, once we’d created the class, to make several of them, all bouncing around simultaneously. This would have taken us a lot more code to do if we hadn’t made a class. As always, the files can be downloaded from our Github page.

 

 

 

 

 

 

Hackers – Project SABRE

ProjectSABRE

In the Hackers group, we started working on design of semi-autonomous or fully-autonomous battle-bots.

We are using the name “Project SABRE” as described in the graphic above.

Members of the group took first steps in learning how to control a robot by setting up a controllable circuit for LEDs.

This should be an interesting project to return to after the break!

DSC_2258

 

Explorers – Week 6 – Halloween Scene

Hi everyone,

Hope you enjoyed this weeks session and remember we are off for the mid-term and so our next session is on the 11th of November.

To get ready for the spooky season we created a Halloween Scene, lots of scary sounds and switching of costumes to create the effect of movement.

I chose a Witch with a wolf howl but I saw lots of great ideas as I was going around the room. Some had Ghouls, others Vampires, its was all pretty scary.

We also learnt a nice trick for giving the allusion of movement. We had a bat change both its size and Costume and it worked very well to give the effect of the bat flying towards us with the moon behind it.

Here are the notes in PDF from this weeks sessions CDA-S6-Week_06-Halloween

Also if you want the completed Scratch Code you can download it by going on to the Scratch.mit.edu website login to the CoderDojo Account (details are in the notes) and search for CDA_Martha_Week06.

Hope you have a great Halloween, be safe when you are out Trick or Treating but have lots of Fun!!

 

 

Hackers – More 3D Modelling

Slide1

This week in the Hackers group, rather than demonstrating how to use SketchUo, we showed some models that Kevin/Michael had built (see above), and the challenge was to recreate them. Some people got so far as to be able to print their models.

We also started some planning on an overall theme – more on that next time.

Explorers – Week 5 – Guessing Game

Hi everyone,

Well! didn’t we have a very studious bunch of Ninjas last week, all very focused on our new game. Last Saturday we did a slightly different game to usual., There was no movement, no sensing when something happened. It was a Maths Game, a guessing game where the computer picks a random number and we had to guess the number.

We had to first make sure that a random number was picked using an Operator. Previously we have used a Variable to store a Score or Lives, but this time it was storing the random number and our guesses. Leaving them on screen as we were testing allowed us to understand more about the variable and what it does…it also made the testing a little easier.

Depending how any guesses we were given we repeated our code that number of times. As well as having to make decisions, i.e If_then, we also had to do a comparison before making the decision, to determine whether the guess was correct, too low or too high.

5guesess

I hope you all enjoyed the difference this week and we are going try something else different next week. We  (You)  are going to create a Animated Halloween Scene. Get your Thinking Hats On!

Here are this weeks notes in PDF: CDA-S6-Week_05-GuessNumbers.pdf