databot - Innovative STEM education tool

Intro to Arduino

PDQ2

A Peek Under the IDE Hood

Overview

Grades:
Time:
Subject:

5-7
5-15 minutes
Computer Science, Electronics 

This PDQ provides a quick and easy peek at some sample Arduino Code. Have no fear – it’s simple and clear!

Background

Arduino is both an Open Source hardware AND software platform that enables creators, inventors, students and just about anyone to learn basic electronics and coding to make projects. The FREE software for programming your Arduino hardware is called Arduino IDE. IDE stands for Integrated Development Environment. The IDE is available for computers running Windows, MacOS, and LINUX. Let’s take a look!

Objectives

Understand & Recognize:

  • “Arduino” as a hardware and software platform for making projects.
  • “Open Source” as a model of creating and sharing information.
  • “input” and “output” in both hardware and software based on looking at Arduino projects.
  • “Community” in the sense of people connected through a common interest such as making cool projects with Arduino.
  • “Computer programming” or “coding” means writing instructions for the hardware to follow.

What You'll Need

databot™ - Innovative STEM education tool

The activities in this module only require you to have some kind of Internet connected device and a browser! Chromebook, smart phone, supercomputer – whatever you have on hand to search the Internet is all you need!

Important Terms

Open Source: A model of sharing inventions and information for others to use, improve and share again.

Hardware: The”physical” part of a computer or device. If you can thump it on a table, it’s probably hardware.

Software: The computer program or “instructions you write” for the hardware. It’s not something you can thump on the table, but the hardware is worthless without it.
Sketch: A “sketch” in Arduino lingo refers to a computer program you’ve written in the IDE to run your Arduino hardware.

Code: The actual lines of instruction in your computer program (sketch) are code. Code is written in different languages such as Arduino. Code is also a verb – “I’m going to code for a few hours – see you later!”

Arduino IDE: IDE stands for Integrated Development Environment which is a mouthful, but it just means you have all the tools you need to write fun instructions for your Arduino microcontroller to follow.

Input: Things that go “into” a computing system are input. When you type on your phone you are “inputting” information.

Output: Something that come out of. your computing system, like the display on a smartphone, is “output.”

Prep

Read Overview and watch video.

PDQ 2 - Check out the Code!

This image is an actual screen capture from the Arduino IDE. Look for the following in the screen cap to help you understand the Arduino IDE!

What you are looking at is an Arduino sketch. It is an example of software that provides your Arduino hardware with a set of instructions to follow. The instructions are written in code. This code is written in the Arduino programming language.

  • Notice the line numbers. These help you easily reference the line of code you are working on. For example, “Hey Jake! Take a look at line 34 of this code for me!”
  • Look now at line numbers 1 and 23. You will see the symbols /* and */ . The text between them explains the program. Also look at lines 25 and 27 for //. These are incredibly important and are used throughout the code as “comments” – this is where you explain things for yourself and others to understand. Remember, when you are working on a piece of code, it makes perfect sense. But a year later it can be hard to remember. A good coder comments well to help those who come later – be a good coding citizen!
  • Note in the comment line 27 the reference to “output” – what is the output in this project? What is the input?
  • Take special note of line 20 and “Public Domain” – this means this code is FREE to share and use again. The concept of “open source” is magical – you share what you build and other’s can build on it and share it back.
  • Plus you get to benefit from the millions of other coders sharing solutions that might save your bacon one day!
  • Here’s a simple coding challenge. Look at line 36. This program causes an LED to “blink” on the Arduino board. Look at the comment – how would you change the command delay(1000) to make the LED blink faster?

Wow, you came off the blocks like a rocket!

Since you came off the blocks like a rocket in PDQ 1 and 2, are you ready for a bigger bite? Next stop, the Experiment!

Next Step, Time to Experiment!

Educator Info

Educator Info

  • Recognize the term “Arduino” as a hardware and software platform for making projects.
  • Understand the concept of “community” in the sense of people connected through a common interest such as making cool projects with Arduino.
  • Recognize the concepts of “input” and “output” in both hardware and software based on looking at Arduino projects.
  • Read through the sample code and complete the highlighted checklist so that you are familiar with the concepts presented.

There are a number of misconceptions about programming and coding that you can begin to address with this simple activity. Here are three:

  • Coding is a “boring” repetitive task. Not true! Coding is like a puzzle that you need to solve. Finding the best and most efficient way to accomplish something in your code can be fun and challenging.
  • Coding is only for those who are super smart at math. Not true! The most important skills required are to be methodical, logical, and persistent.
  • Coding is not creative. Not true! Solving problems efficiently and elegantly requires great creativity. Think about the software you use on a regular basis for work or play. Someone had to come up with all of those ideas and features. Someone had to create the idea behind Angry Birds long before it ever became polished software.
  • “Looking at this example of “code” – is this what you expected a computer program to look like?”
  • “Which line number marks the most interesting line of code to you?” and “What lines of code don’t you understand?”
  • “It’s pretty cool to see the names of the people who wrote this program – imagine writing something useful that you could release as Open Source that millions would see and use!”

Intro to Arduino by Robert O. Grover & Team databot is licensed under a Creative Commons Attribution 4.0 International License. Permissions beyond the scope of this license may be available at databot.us.com/contact.