Bodgers – Cool Projects

Hello again everyone.

In the Bodgers group we’re starting to put our projects together for the Coolest Projects Showcase.

“Coolest Projects International is a world-leading showcase for young innovators who make stuff with technology. If you’re up to 18 and you’re making something with technology for fun, to solve a problem, or as a creative outlet, then we want you to come out and share your project with us! This free event will take place in the RDS Main Hall, Dublin, Ireland on 5 May 2019.”

Find out more here: https://coolestprojects.org/

If you have any questions you can contact me at coderdojoathenry@gmail.com.

Don’t forget we’re off for the next 2 weeks, we’re back on 27-Apr-19.

see you all then.

Declan, Dave and Alaidh

Creators: Drumtown!

Today in Creators we played a bit more with sound and built a type of musical instrument using Javascript.  The project was called “Drum Town” because it was based on the idea of a music mad building and when you wake up one of the resident’s by clicking their window, they would play a particular sound every time some traffic cruised past.  Each floor consists of people with the same instrument.  What else would they do?

Play the finished Project by clicking here! – Make sure to TURN UP THE SOUND!!

drumtown

How did we build it?

The awesome thing at this stage is that the group has become so competent at javascript that as soon as we had the idea, some people put their heads down and started building without a whole lot of direction!!  I won’t go into the ins and outs here, but the code is up on our repository and you can go through it!

Interesting bits!

Some of the interesting bits of the project are:

  1. Classes:
    As usual we needed a few classes – this time we used classes for the Car and the Window.  The basic idea was to have a car moving at a constant speed left to right and to have windows that play a sound whenever the car goes past.
  2. Unicode Sprite Characters!
    We learned that now text is getting more and more graphical – we can see it on our phones with emoticons.  There are a large amount of emoticons in standard fonts and if you enable the windows keyboard (right-click taskbar and choose “Show Keyboard” you get on onscreen keyboard that can type all sorts of characters – we used these for our cars:  and could write crazy looking code like:  this.carList= [🚗, 🚚, 🚛, 🚕, 🚜]; .  This will make it REALLY easy for us to write games with nice looking costumes without messing with images.
  3. Sounds:
    I handed out some sounds for us but you can put whatever sounds you like in your own version.  I got my sounds from this website here which has TONS of free instrument sounds!  We named the sounds 0-6.wav to make it easier to use loops to reference them.

That’s it!  Take a read through the code, I finished it off a little before pushing (mainly added a title).  It would be great to make your own version with a different them and a different set of sounds perhaps.  Also – maybe this can give you ideas for other types of musical instrument that you can create, perhaps with a completely different model. Have fun with the emoticons too 📯🎷🎺🎸🎻!

Bodgers – RFM69 Radio Modules

 

DSC00227

Hello again everyone.

This week we looked at the Adafruit RFM69HCW Radio Module, these modules allow us to send messages between Arduinos without using Wifi or Bluetooth.

Adafruit have a tutorial here on setting up the module. The basic steps are:

  1. Solder on the header pins.
  2. Solder antenna or wire cut to the the proper length for the module/frequency
    • as our frequency is 433 MHz  we cut the wire to 16.5 cm.
  3. Wire up modules to your Arduinos
  4. Download the RadioHead library to your Arduino IDE.
  5. Load the RadioHead69_RawDemo_TX code from this library to the Arduino you’re using to transmit.
  6. Load the RadioHead69_RawDemo_RX code from this library to the Arduino you’re using to receive.
  7. Test

Next Saturday we will be putting all of the different components from our projects together and testing out how they work.

see you all then.

Declan, Dave and Alaidh

Creators – Flying Over Dynamic Terrain

 

This week we creating a game where a tiny plane flies over dynamically generated terrain picking up as many boxes as possible. The player scores a point for every box, but that also makes the plane fly faster, making the game more challenging.

Perlin Noise

Normal random-number generators produce values that jump around all over the place. Perlin noise is different. It is also random, but it varies smoothly. This makes it great for mimicking the sort of randomness we see in nature.

1D Perlin Noise Landscape

Our smooth and changing landscape is generated using a one-dimensional Perlin noise value generated by the P5.js function noise(xoff).

We start with a loop that goes across from 0 -> width across the screen. We’re looking to generate a set of [xy] points that define our shape.

We use these values:

  1. xstart: A starting value for xoff
  2. xinc: An amount to increment xoff by for every new location
  3. ymin: The smallest y value we want for our landscape – something a little below the top of the screen
  4. ymax: The largest y value we want for our landscape – something a little above the bottom of the screen

Each call to noise() generates a single value in the range 0-1. We use the P5.js function map() to change this value in the range 0-1 into a value in the range ymin-ymax.

Changing the size of xinc controls how choppy or smooth the landscape is. We tune it to a value that gives approximately two peaks and two valleys across the screen, and looks right for our game.

Moving the Landscape

Moving the landscape is achieved by changing the starting value of xoff (aka. xstart) each time we update the screen. By making it a little larger each time, the effect is that the landscape seems to scroll from right to left.

Other Parts of the Game

The other parts of the game are very standard. We define a simple plane shape (drawn using rect() calls)  that can move up or down in response to the arrow keys.

We define “cargo” containers that are randomly generated on the surface of the landscape and move right-to-left at the same speed.

The cargo containers have an active property that is false if they move beyond the left-edge of the screen or get sufficiently close to the plane to be “picked up”.

We added a function to the landscape class (Ground.js) that checks for a given [x, y] location to see if that point us under the ground by checking what the height of the landscape is at that x value. If the plane is below the ground we consider it crashed.

We added a simple scoring mechanism that tracks how many boxes were collected and makes the plane move faster (really – the ground scroll faster) every time a box is collected.

Download

The files for this week can be found on our GitHub repository.