Forums - SARCNET

School Amateur Radio Club Network
School Amateur Radio Club Network
School Amateur Radio Club Network
School Amateur Radio Club Network
Go to content

SARCNET Arduino Challenge

Published by Julie & Joe in Arduino · 24 August 2019
To welcome three new schools to SARCNET and to get to know each other better we are having an Arduino challenge. You can use this Forum to start your own Arduino Challenge! The idea is to start with an already working program and to hack it to do something really cool. First, get the Arduino IDE running on your PC and attach your favourite Arduino board. Connect an LED, in series with a 470 ohm resistor, between any numbered pin (say pin 9) and GND.

Next, open a new sketch, copy and run the following program:

void setup() {
pinMode(9, OUTPUT);
void loop() {
digitalWrite(9, HIGH); 
digitalWrite(9, LOW);

Now, to create your own project: Add more LEDs, if you like, and change the code to make the LEDs flash in a really cool sequence. Build the Arduino and LEDs into a cardboard model. Take a video of your working project so that everyone can see what you have done. Note: To keep it simple we are only using LEDs and the functions shown above. Here are some project suggestions. It doesn't matter if you choose the same project as someone else as long as you do it yourself.

  1. Emergency flasher beacon (On-Off or SOS. 1 LED). Bike light.
  2. Hypnotic OWL (2 LED eyes) – Substitute your own cardboard animal or robot.
  3. Traffic lights (3, 6 or 12 LEDs)
  4. Airport runway approach lights (white) or port channel markers (red/green) (5 LEDs)
  5. Arrow sign (8 LEDs)
  6. Wearable Electronics: Name Tag (Morse code), brooch, pendant, earrings or necklace
  7. Roulette wheel or Dice (may need help to randomize it)
  8. 7-Segment LED Timer or Bar-graph LED Display
  9. Christmas tree lights
  10. Modern art or home decoration

Post your own project details, code snippets, problems and solutions here.

Julie & Joe
2019-08-25 01:30:33
While doing the International Arduino Challenge some students have noticed that they have to repeat the same instructions over and over again. They asked if there is a way to make it easier. For example, Ethan is writing a program to make a 7-Segment LED display count from 0 to 9. After each digit, he needs to turn off all seven LED segments. The code is quite repetitive. Well, Ethan discovered a way to reuse blocks of code. It is called “functions”. In fact you have been using functions probably without noticing it: Remember our Arduino mantra for creating a new program:

“Void setup round-brackets curly-brackets. Void loop round-brackets curly-brackets” Here is what that looks like:

void setup() {

void loop() {

The setup and loop blocks above are actually “function declarations”. The Arduino must have them to setup and run your program. You already know to put your own code in-between the curly brackets of these functions. Well did you know that you can create and use your own functions? Since Ethan wants to turn off all his LED segments, connected to pins 2 to 8, he created a function called “turnOff”, which did just that. Here is what it looks like:

void turnOff() {
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, LOW);

He put this code right at the start of his program so that it can be used anywhere within the setup and loop functions. Now instead of having to type out all seven lines of code, again and again, he just inserts the following line in his code whenever he needs it:


Pretty clever, eh? Well done Ethan.
Julie & Joe
2019-08-25 01:36:12
Continuing on with our discussion of functions - arguably the most powerful part of any programming language - we saw how functions can replace a whole block of instructions, just by typing their name. But what if you wanted the function to do something a little different each time you called it? For example, suppose you connected three LEDs to our Arduino (pins 2, 3 and 4) and you wanted it to flash each one on for 1, 2 and 3 seconds. You would normally have to write the following instructions:

digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, LOW);

Looking at the code above, it is hard to tell what it is doing and it would be hard to change the pin numbers and the delay periods later on. Wouldn’t it be cool if you could just write:


Yep! So, to do that you just create a function, like this, and put it at the top of your program:

void flash(int pin, int period) {
digitalWrite(pin, LOW);

Now if you write “flash(2,1000);” in your code, the flash function above is called with the numbers 2 and 1000 passed to it. We call these numbers "parameters" and their order is important. Inside the function, the first parameter is stored in an integer variable called “pin” and the second parameter is stored in an integer variable called “period”. So the function writes to the pin and delays for the period that you specify.

More on functions later...
2019-10-30 00:26:09
I created a short sketch from scratch which sounds out my amateur radio call-sign via a buzzer and flashes a LED. I created a line of code for a dot and a line for a dash then did a lot of cutting and pasting. May even get to like this sort of programming. Remember always but a 220Ohm resistor in series with your LED

Back to content