# Hackers – From Programming in Scratch to Programming in C

Maybe you can already program in a language like C, you just don’t know that you know it yet?

• Turing Equivalence (the idea that different programming languages are can do the same job, if they have some key features)
• Alan Turing (computer scientist and code-breaker, after whom Turing equivalence is named)
• The Turing Test (Alan Turing’s test for whether an AI system can be considered to be intelligent)

Our main focus, however, was on relating a programming language that everyone is familiar with, Scratch, with the language that is used to program Arduino, which is based on C/C++. C and C++ are professional programming languages, text based, that don’t look much like Scratch.

However, it turns out that they share important key features that make them Turing equivalent, and these are the basis for basically all major programming languages:

• Variables and operators
• Loops
• Decisions

Therefore, if you can come up with an idea of out how to write a program in Scratch, you can probably translate that idea into a language like C.

Here are the notes in PDF: CoderDojo-Hackers-IntroToC

We also spent a bit of time lighting an LED by connecting it to a battery in series with a resistor. Next week, we will use this as the starting point for making an Arduino-controlled electrical circuit.

# Modellers – Week 2

Hi folks, thanks for another great session on Saturday.

This week we looked at going beyond the object level and actually editing object meshes. With an object selected you can switch into edit mode by using the drop-down list on the upper left-hand side of the 3D viewport or, more commonly, by pressing the TAB key.

Meshes are made up of three parts:

1. Vertices: I tend to also call them nodes, as I did in the diagram below. The represent a point in space
2. Edges: A line between two vertices
3. Faces: A flat solid area bounded by three or more edges (normally four in Blender)

Faces are also known as polygons. Ones with three sides are called tris (short for triangles), ones with four sides are called quads and ones with more sides are called N-gons. The ends of Blender’s standard cylinder object are examples of N-gons. N-gons can cause strange shading effects when using smooth shading and we try to generally avoid or minimise them.

Editing at the mesh level

Once editing the mesh, all the usual tools that we had available at the object level (namely Move (or Grab), Rotate and Scale) can be used, but now on vertices, edges and faces.

You can work with vertices, edges or faces, as suits what you’re trying to do. To indicate which you want to use, use the buttons towards the top-left of the 3D viewport or the handy shortcut buttons 1, 2 and 3.

The standard cube is too simple to start shaping We saw three ways to add geometry:

• Adding edge loops: An edge loop is a cut that runs cleanly all the way around the object. They are easily added using CTRL-R and then using the scroll wheel to adjust the number of cuts and moving the mouse to indicate which edge you want them to go through.

• Extruding. Select a face and hit the E key, you can then drag it and it will move while newly added faces connect it to its original location. The effect is like forcing Play-Doh through a hole.

• Inseting: Select a face and hit the I key. Move the mouse and you will see a smaller face, the same proportion as the original, is created inside the original face and four more faces connect it to the original edges.

Exercise

For the second-half of the session, we took a cylinder shape and started to sculpt it into a candlestick shape. A few lessons from that were:

1. We started with the simple cylinder and added loads of loop-cuts to allow us to shape the candlestick shape.
2. We saw how proportional editing can be switched on to allow vertices connected to those we’re directing editing to be moved as well.
3. We saw how the bottom and top of the cylinder are N-gons and look strangely domed when smooth shading is on. We resolved that by insetting the face to minimise the N-gon’s size and extruding it out of the way a bit.
4. We saw how adding loop-cuts near an existing edge can restore a sharp edge to our model when smooth shading makes it seem too soft and round.
5. We saw how the “Metallic” and “Smoothness” sliders can be used on a material to make it look like shiny metal.

Next Week

Next week is intended as a free-form session, bring your best ideas for simple projects and we’ll try to help you achieve them. See you then!

# Explorers Week 03 – Our first Game – Balloon Ninja!

Hi everyone,

Great to see you all yesterday and I hope you enjoyed creating your first game in scratch.

its important to take a moment to make a plan, in the long term it will save you time if you have a clear idea of what you want to create.

I didn’t make it easy on you and we went straight into learning about variables to create our score and lives.

I saw some fantastic games around the room with Dinosaurs and Doughnuts and Unicorns, much better ideas than I could ever come up with.

I gave you the option of whether you wanted to add a time or not. It is a piece of could yo can add to any of your games as it can add a sense of tension or urgency to a game.

Here are the notes from this week in PDF CDA-S8 Week_03_BallonNinja.PDF

Thanks again for coming and see you next week.

Martha

Julie, Iseult, Eoin and Ruaidhrí

# Hackers – Starting Programming Arduino

In our first week in the Hackers group, we began with an intro to what we do, which is to help people work on their own projects. In the first few weeks, we will focus on learning some useful technologies that people can then start applying to their own work.

Everyone introduced themselves and talked about what projects, if any, they planned to work on, and the mentors suggested some possible technologies that may be useful.

We decided to start by learning how to program the Arduino, which is a microcontroller that runs one program at a time – as soon as it is powered up, it runs the code in a function called setup(), and then it keeps running code in a function called loop().

Arduino is programmed in a version of the C Programming Language, which is a very well-known language.

To write a new program for Arduino, you connect it to a computer and use the Arduino IDE (interactive development environment), which we downloaded here: https://www.arduino.cc/en/Main/Software

Arduino is mainly used to control hardware, and we will see how to do that in future weeks. For this week, we did not control external hardware, but just a built-in LED.

We began by following this tutorial to write code to make an LED blink: https://www.arduino.cc/en/tutorial/blink

Then we started expanding it …

• We decided to flash an SOS message in Morse Code
• We found out that a dash is 3 times as long as a dot, and the interval is the same length as a dot
• We found out that you need a short delay at the end of each letter (3 dots long) and a longer one at the end of each word (7 dots long)
• We made functions for dot(), dash(), and letters such as S and O
• We looked up Morse Code for the other letters, and wrote functions for them
• We added a variable so we could control the speed of the flashes

Here is one version of the final Arduino program. Note that it is incomplete, it just has a few of the letters of the alphabet.

```// Code by Michael from CoderDojo Athenry.
// A program to display messages in Morse Code by flashing an LED.
// This is not complete - just some examples.

int interval = 300; // this controls the speed of messages in milliseconds

void setup() {
// Set up the LED as an output pin. The built-in LED is represented by LED_BUILTIN.
pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
// Keep repeating our message over and over.
A(); // Morse code for a letter
B();
S();
endword(); // At the end of each word there is an extra delay
}

void dot() {
digitalWrite(LED_BUILTIN, HIGH); // send 5 volts
delay(interval);
digitalWrite(LED_BUILTIN, LOW); // send 0 volts
delay(interval);
}

void dash() {
digitalWrite(LED_BUILTIN, HIGH); // send 5 volts
delay(3 * interval);
digitalWrite(LED_BUILTIN, LOW); // send 0 volts
delay(interval);
}

void endword() {
digitalWrite(LED_BUILTIN, LOW); // send 0 volts
delay(4 * interval);
}

void endletter() {
digitalWrite(LED_BUILTIN, LOW); // send 0 volts
delay(2 * interval);
}

void A() {
dot();
dash();
endletter();
}

void B() {
dash();
dot();
dot();
dot();
endletter();
}

void S() {
dot();
dot();
dot();
endletter();
}

void O() {
dash();
dash();
dash();
endletter();
}
```

This week Eoin led the Advancers group, we looked at drawing in Scratch, using the Pen blocks and some simple maths to draw some patterns.

As always, we started with a Plan:

A Plan

1. A Button Sprite – to start the drawing.
2. A Simple Sprite to do the drawing.
3. Some maths to make it draw a Spiral

We started by drawing a square, to draw a square in Scratch we used the Pen down, Turn and Move blocks.

To get a spiral effect we had to make sure that we moved a little bit further each time we drew our square.

We also decided that we should be able to make spirals with different shape so we  needed some variables to help:

• Shape – This would tell us how many sides the Spiral should have
• We made this in to a Slider on the screen so it was adjustable.
• Min value was 3 and Max value was 100
• Degrees – This would tell us how much extra to turn, this made the patterns a lot more interesting.
• Again, we made this one into a Slider so we could adjust it.
• Min value was 0 and Max value was 360
• Size – This was an internal variable, which we used to keep track of how many Steps to move each turn, we also added a little bit to it each turn to make the Spiral pattern.

## The drawing Sprite

This was the Sprite that did all the work. To work out how far we should Turn each time, we divided 360 by the number of Sides, we then added the degrees value to get the strange effects working.

The code ended up looking like this:

## The Button Sprite

We used this sprite to start drawing, we used a broadcast so out button sprite could “talk” to out drawing sprite.

Oliver will be back next Saturday.

See you all then Declan and Eoin

# Modellers – Week 1

Hi folks and welcome to our new group, Modellers. This year we’re going to be mainly looking at the 3d modelling package Blender Version 2.80.

Blender can be installed from: www.blender.org. Please note that it requires OpenGL Version 3.3 or higher and as a result may not work on some older machines

This week we learned:

1. The 3D viewport and moving around in it:
1. Middle mouse button: Orbit
2. Shift + Middle Mouse Button: Pan
3. Scroll Wheel: Zoom
2. Selecting objects with the left mouse button
3. The toolbar tools for moving, rotating and scaling objects
4. Deleting objects with ‘x’
6. Adding a new material slot and a new material and assigning a colour to it
7. Putting the 3D Viewport into “Look Dev” mode so that material colours can be seen

We also gave out copies of a very convenient Blender Infographic which can be found here.

# Explorers Week 01 – Getting to know Scratch

Hello everyone

Welcome to Coderdojo Athenry and the Explorers group! It was great to see so many new faces on Saturday and of course I’m always delighted to see those you are back for another year!

We just spent a short time familarising our self with Scratch and where we can find the code and some small examples od how we can use them. We will start a new game this coming week and will jump straight in using variables, loops and decision statements.

Here are the notes from last week. CDA-S8 Week_02-YourNameinLights.pdf

Martha

&

Julie, Iseult, Cara, Ruaidhrí and Eoin

# CoderDojo Athenry Information Session, Sept 2019

Thank you to everyone who came along for our information session yesterday Saturday 14-Sep-2019.

Michael introduced us to the CoderDojo movement and then talked to us about CoderDojo Athenry and what we have planned for 2018/2019. Michael’s presentation is here:CoderDojoAthenry-InfoSession-2019-Sept .

Julie then spoke about our loaner laptops where we provide laptops for people who don’t have their own. Speak to Julie or any of the mentors (we’ll be wearing blue t-shirts) for more information.

Martha then spoke about Health & Safety and our shop, where we sell tea/coffee with biscuits for €2.00 or €1.50 if you bring your own cup, with all profits going towards equipment etc. for our CoderDojo. The H & S and Coffee Shop slides are here: HS-and-Coffee .

This year, we have 4 different rooms with different topics in them, for different levels of experience and age.

Explorers- led by Martha for Beginners from around age seven. They use the Scratch programmimg language to build games, quizes and animations. Here are Martha’s slides: CDA-Explorers-S8-Information-Session .

Advancers- led by Oliver is for kids who have already been through Explorers. They tackle more complicated programming concepts, during the year the Avancers group will investigate various topics like gravity, music and even what happens when water boils using Scratch.

Modellers- led by Kieran is for older kids who have been through Explorers and Advancers. The Modellers group will concentrate on making 3D game resources using apps like Blender and Gimp. Here are Kieran’s slides: CoderDojoAthenry-Modellers-KickOff-Sept2019.

Hackers- led by Michael for older teenagers who have been through Creators and Bodgers. The Hackers group themselves usually decide what topics they will cover with many of them working on their own projects. Here are Michael’s slides: Hackers-Intro-Slides.

Kids are free to move between rooms until they find a topic that suits them.

To find our schedule for the 2019/2020 sessions click on the schedule button at the top of this page.

If you have any questions or if you need any help, please talk to me or any of the mentors.

See you all next Saturday.

Declan and the CoderDojo Mentors

# CoderDojo Athenry Returns on 14 September 2019!

CoderDojo Athenry is starting back with an information session on 14 September 2019 in Clarin College Athenry (“the Tech”) at 12:00 noon. All new and existing members are welcome to come along to find out what we have planned for this season.

Regular weekly sessions will start the following week, 21 September 2019, 12-2pm in the same venue.

New members are always welcome. If you are aged between 7 and 17, just come along on the first day and fill out a registration form. Young people aged 12 and under have to be accompanied by a parent/guardian for the whole session.

And don’t forget, CoderDojo Athenry is run by volunteers and is completely free for participants — no membership fees, no weekly contributions. You should bring a laptop if you have one, but we have some loaner laptops if you don’t. There is more information on our About page.

# Congratulations to all our ninjas who received belts in Summer 2019!

On 2 May 2019, at our final CoderDojo Athenry session of the 2018-19 year, we awarded a total of 75 belts to our ninjas for their great individual achievements in acquiring and demonstrating coding and computing skills. And then we had a party with pizza!

Here is a link to our presentation from the day: CoderDojo Athenry Belts Day 2019

We are very grateful to Clarin College Athenry and the principal, Ciaran Folan, for their enabling CoderDojo Athenry by making the school and its wifi available to us.

We are also very grateful for the sponsorship and support we have received this year:

• Galway Roscommon Education and Training Board, who provide us with an annual Youth Club Grant
• Medtronic, employer of our mentor Declan Fox, who provide us with a grant to match Declan’s excellent volunteering
• HP Enterprise, employer of our mentor Mark Davis, who provide loaner laptops that we make great use of
• Boston Scientific, employer of our mentor Kevin Madden, who provide us with 3D printers.

Thanks also to everyone who supported us by buying tea or coffee!

Because of these supports, no child or parent/guardian ever has to pay to participate in CoderDojo Athenry.

And of course we must thank our mentors, who volunteer their time and expertise entirely without charge week after week, to make CoderDojo Athenry the success that it is.

Here is the full list of belts we awarded:

• Explorers:    34