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!

Bodgers – Making A Model Of A Heart From A Plastic Bottle.

Hi Everyone,

I don’t have any new notes from the Bodgers group as everyone is still preparing for the Zombie apocalypse. We will be filming the projects for our entries to the Pioneers competition next week so we will have a longer session than usual, we will finish at 3:30pm.

Here is a link to the experiment I was demonstrating for the Medtronic visit. In this video they use sandwich bags to make the valves but you can also use the straight part of a balloon or fingers from disposable gloves.

 

Here are instructions on how to make the stethoscope Malachy  demoed.

stet

See you all next week,

Declan,

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.

 

 

 

 

 

 

Week 7 2017 – Explorers – Piano

Hello everyone,

Thank you all for coming again this week and I hope you enjoyed the Halloween break.

This week we did a simple Piano.

piano

We only had to draw two keys, and then could duplicate these and change the names. The same applied to the code. The code is the same for each key apart from one small change so the note is the appropriate for the key.

REMEMBER! You need to make four changes each time you duplicate:

Change the name of the spite to the next Note

Change the name of the TWO costumes

Change the NOTE played

Piano2

Piano3

 

Here are notes from this week in PDF CDA-S6-Week_07-Piano.pdf

Martha

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