SUMMER STEM-HEALTH CAMP
  • Home
  • 2025 RCC Camp
    • Day 1: Basic Coding >
      • Button Control
      • Multicolor LED
      • Fading multicolor led
      • Melody (sound)
    • Day 2: Servos and Potentiometers >
      • DC Motor
      • Ultrasound
      • Potentiometer and Motors
      • 2 servo control >
        • Analog Stick Control
      • PIR Motion Sensor
      • IR Light Proximity Sensor
    • Day 3 Making an ECG/EKG! >
      • ECG/EKG health lesson
      • OLED Screen Basics
      • Pictures to OLED
      • BPM on OLED
    • Day 4: Measuring Pulse >
      • Scrolling Screen Graph
      • How the body absorbs light
      • Screen Pictures
      • IR Temp Sensor And Screen
    • Day 5: Finishing up/Show >
      • IR Light Proximity Sensor
      • PIR Motion Sensor
      • CO2 Sensor
      • Ultrasound distance sensor
  • The Teachers
  • Our Partners
  • Archive
    • 2024 Health-STEM Coding Camp >
      • Home (2024)
      • The Teachers
      • Day 1: Basics and Lights
    • 2024 Coding/Robotics Camp >
      • Day 1: Basic Coding >
        • Saving your codes
        • Engineering design
      • Day 2 Servos >
        • 2 Servos, one potentiometer
        • Multicolor LED >
          • Fading multicolor led
    • Pictures from prior years
    • 2023 3D Design Camp >
      • Day 1: 2D design
      • Day 2: 3D design basics
      • Day 3: Constraints
    • 2023 Health-STEM Coding Camp >
      • PreAcademy prep
      • Day 1: Basics and Lights >
        • Multicolor LED
        • Button Control
      • Day 2: Ultrasound >
        • Ultrasound Health Lesson
        • Supplement Melody
        • Supplement: Servo >
          • Potentiometer and Motors
          • 2 servo control
      • Day 3: Measuring Pulse >
        • How the body absorbs light
        • OLED Screen Basics >
          • Scrolling Screen Graph
      • Day 4 Making an ECG/EKG! >
        • ECG Health Lesson
        • Pictures to OLED
        • BPM on OLED
      • Day 5: Finishing up/Show
    • 2021 STEM Camp (HS) >
      • The Teachers (2021)
      • PreAcademy prep
      • Day 1: Basics, Lights, and Temperature Sensor >
        • Day 1 Supplement: Measure Temperature
        • Day 1 Supplement: IR Temp Sensor
        • Day 1 Supplement: Identifying Resistors
        • Supplement: Controlling A Servo
      • Day 2: Measuring Pulse >
        • How the body absorbs light
        • IR Light Proximity Sensor
        • PIR Motion Sensor
      • Day 3 Supplement: OLED Screen Basics >
        • Display Screen Temperature
        • Scrolling Screen Graph
      • Day 4: Finishing up/Show
    • 2021 STEM Camp (MS) >
      • PreAcademy prep
      • Day 1: Basics, Lights, and Temperature Sensor >
        • Day 1 Supplement: Identifying Resistors
        • Day 1 Supplement: Measure Temperature
        • Day 1 Supplement: IR Light Proximity Sensor
      • Day 2: Ultrasound >
        • Day 2 Supplement: IR Temp Sensor
        • Day 2 Supplement: Controlling A Servo
      • Day 3: Measuring Pulse
    • 2020 STEM Camp
    • 2018 Lessons
    • 2017 Camp
  • Contact Us!
Picture

Introducing Arduino IDE

First, we will need to open the software, which is called Arduino IDE (integrated development environment). If it is not already open, go ahead and open it. It should look like the picture below if it is open.
Picture
Before coding, let's get familiar with the IDE. Here is some vocabulary and where to find the different parts. 
We will show you: 
  • The Global area (where variables are declared)
  • The setup () function
  • The loop () function 
  • The Serial Monitor and Serial Plotter
  • How to save the sketch to desktop 
  • How to verify code
  • How to upload (aka send) code to the Arduino
  • Where error messages display
Picture
Picture

This is a video of IDE basics 

If you are doing this on your own at home, this video teaches you what we did in class. 

 Lesson 1: Learn How to Code!

We will start with writing simple code, saving, and sending it to the Arduino. ​Let's start by getting the board's orange light to blink like this. 

Here's code to blink the Arduino

Let's Write our first code. 

Step 1: Type up this code. Capital letters matter. 
Picture

Checking your code. 

Step 2: Push the check box at the top left of the page. This verifies (aka checks) if the code should work.
It "compiles" the code. That means it turns it from human readable to computer readable language.
Picture

See if you get an error message?

Step 3: Check to see if an orange error message appears in the box at the bottom of the page.
​An example is on the right
Picture

If you got an error message, check the following things.
1) Are all the colored parts in this picture here colored in your code?
2) Check CaPiTaL letters. (they matter)
​3) Have you forgotten a ;
4) You may have forgotten a ( or )
5) Are there curly brackets, {   } 
                             
​If you get no error (the bottom box is not orange), then you can move on.

Still having issues? Let your teacher know!​
Picture

If you are having issues, read this. 

You may not be used CaPiTal lEttErs maTterING! Things change color as you type them correctly. The words like OUTPUT, HIGH, setup, and LOW will not change colors if you type them wrong. 

Another thing that you may not have seen before is an under-script, it looks like this _. To type _ you have to hold shift and - at the same time. The minus is beside the 0 (zero). 
​

Another new thing is every line of code ends in a ; semicolon. That button is beside the L.

You also may not have seen a curly bracket {   } before. That can be found next to the P key. To make a {, hold Shift and [ . To make a } hold shift and ] . 

Sending the code to the Arduino

Step 4. Upload your code to the board 
     a) Plug the blue USB cord into your Arduino and computer. 

     b) Select the right arrow button (next to the check mark in the top left corner) to send your code to the board. 
Picture
Picture

What is your Arduino doing? Is the code working? 
Below explains what each line of code is doing. 

Picture

The // double dashes are just comments. You do not need to type them. The Arduino does not do anything with them. They they help people know what each line of code is supposed to do. 

Remember, this video shows what the Arduino should be doing.

Did you get an error? (Is it working right?) 

You may get a "Problem uploading to board" or something similar.
If you do, it is because your Arduino does not know where the Arduino is plugged in. Or, your USB cord may not be plugged all the way in. 
​
 To fix this, click the select board drop-down and select your Arduino. 
Picture
Step 4) If you fixed the port issue if needed, push the arrow button beside the check box at the top again.

Give the board a second to upload, it should be blinking quickly, and then run your code. 
​Let your teacher know you need help. ​

Save

Now that you have made your first successful code, you should save it.
Name it something memorable so you can always find it again later. 

Your teacher will show you how, or you can watch this video.


After Saving, try changing the code

Play around with the code's delay values. Right now it is 1000. Try changing it. What does changing it do? Re-upload to the board after you try it.

Save your new code using a different name. (maybe: "MultiBlink")

Adding more lines to add blinking complexity. 

If you have time, try something creative like adding more HIGH and LOW lines into the loop code to make cool patterns. This can be done like in the example below.
Picture

Save your file, upload to board, and review 

Plug the Arduino board into one of your computer's USB ports. 

After it is plugged in, upload the code to the board. Click the right arrow beside the check mark at the top of the Arduino program. See the  picture below for what that looks like. 
You just made your first Arduino program! Congratulations.

Lesson 2:
Controlling "off-board" LEDs


Now we are going to figure out how to light LEDs from the Arduino board. You will need: Wires, a 220 Ohm resistor, and a red LED.
Picture

Warning: USE A RESISTOR OR THE LIGHT MAY BREAK

It is important to know LEDs only let current flow through it one way.
​If your light does not turn on, try flipping how your LED is connected. It may just be in backwards. 
Picture
LEDs only work when the longer end connects to positive pins on the board. The + pins on the board are any of the numbered pins, the 3V, or the 5V. 
Picture

How to find the 220 Ohm resistor? 

Your kit may or may not have the resistor values written on your strips. If it does not, you will have to find the 220 Ohm resistor using the color combinations on the resistor. To learn how to do that, go to this lesson and your teacher will help you learn how to do this. 
Click Here to Learn How to Identify Resistors Lesson

<--Use this button to learn how


Picture
​The shorter end connects to negative pins (GND/ground). ​​Remember that red is positive and black is negative. Use those color wires to help. 
Picture

Watch this video for how to do it. 


Introducing a Breadboard:
It Connects Many Parts Together 

Breadboards are for when you want many things to work at the same time. 

Yours may be longer than the one in this picture, but they all work the same. 


How does it work?
Picture
Picture
It has different rows and columns all connected together under the holes.

​This picture shows which parts are connected. You may have a smaller board than this, but this picture still shows the basics. 
Picture
Picture

Watch this for more about how breadboards work

Now, let's use this board to connect a bunch of lights! 

Series and Parallel Circuits (LEDs)


Now that you got one light to work on the board, let's try to get lights to work off of the Arduino board. See if you can get several lights to turn on at once. Try hooking up your lights in these three different ways. How are each different. Is the brightness any different? 

This activity does not need any code. It plugs directly into the 5V (aka +) and the Ground lines (GND aka -). Plugging those wires in is just like using a battery. 

Remember: plug in your Arduino with the USB cord!

Single LED

Picture

Series LEDs

Picture

Parallel LEDs

Picture
LEDs are Light Emitting Diodes. Light Emitting  means they make light. A diode is something that only lets electric current go one way. That means direction matters! The longer LED wire is the + side, and the shorter LED wire is the - side. 

Tip: use black wires to connect - parts (aka GND)
and red wires to connect + parts (aka 3.3 or 5V lines)
​See how that is done in the pictures above?  
Picture
You will need
  1) Red and black wires
  2) S
everal LED lights of the same color
  3) A resistor (this picture has what they look like)
Picture
Connect your lights to the breadboard like the pictures above. See what changes between each type of setup (single, series, parallel). Can you figure out how to power all three setups off the same board? Once you get your lights to work in parallel, try to use different colors. What happens when you try to use all different colored lights? 

It is ok if you don't understand how all this works today. 
The more we practice, the more you will get! 


Ask your teacher if you have any questions or need help. 
Picture

Lesson 3: Defining Variables at the start of code

Here is the example multi-blink code from earlier. See how we have to keep typing LED_BUILTIN over and over? We can avoid that by making what is called a "variable". Variables are easily able to be adapted/changed. If you have taken algebra, think solving for x, where x is the variable! 

What if we wanted to change which light to turn on? We would then have to then retype all of the LED_BUILTIN parts, gross! If we make a variable for the light at the start of our code? Then we will only have to change the pin we want to light up in just one spot! 
Picture
See this small change we added to the beginning of our code, line 1? 
This is the variable we are defining. 

Const means constant. That means we are telling the computer that this variable will not be changing when the code runs. 

int means integer. An integer means whole numbers. Integers are numbers like 1, 5, 22, etc. LED_BUILTIN is actually connected to Arduino pin 13, so we could have just typed in 13 there if we wanted. 


Picture

This video explains how to use variables


Changing the variable changes the pin to light up!

Now that we have made that variable, we can control other lights too! 
We can control lights connected to any Arduino pin using our blink code now. I can do that by changing the ledPin variable. Your teacher will now show you what that means. You can control your off-board LEDs using your blink code now : ) 

This video shows some of what you can do! 

Supplemental Lessons Day 1​

Make sure to do the regular day lesson first. Here is a link if you need it.

Multicolor LED

Here is a video showing you the basics. 
Set up your breadboard similar to below and use the 220 resistors for your board. 
It does not really matter what pins you use for red, green, and blue (RGB) as long as they have the ~ symbol in front of the number like ~11 or ~3 etc.

The ~ symbol by an Arduino pin means Pulse Width Modulation. You don't need  to know what that is right now, but that to get the best light results it helps for the 3 color RGB light. 
Picture
Picture
Watch this video to get the background for this activity. 

Getting the colors on (Blinking)

Picture
Use the same code that you used to get your regular LEDs on and off and see if you can get them to turn on the Multi color LED's colors. You may have to change the pin numbers used in your code. If you have trouble, you can start with this code to the left. 

Now that you got one light on, go ahead and change your code to try and change colors or get two colors on at once. ​

Set Colors your own color 

This code is used to set up your led to be multiple colors and brightness at once. 
You change the numbers in the "setColor(255, 0, 0);" part to change what colors your LED makes. 
Picture

Getting the colors to switch

Picture
Now that you have gotten the code to work, try adding the other colors to digitalWrites to get the colors to switch. 
​
You add this to the loop just like you added delays and more digitalWrites to your blink code. 

Once you get it to work, change the values in the set color part to numbers between 0-255 and see what happens
. ​

Analog Write Blink off-board LED 

Look on the rail of your Arduino. Some of the holes digital row have a ~ symbol in front of them. If you look at this picture, the ~ means PWM. That means Pulse Width Modulation. Modulation means it can modulate up and down from various values. The digitalWrite we used before just uses on and off. If you move your wiring to use one of these ~ pins, like ~3, we can make it blink with different brightness.
Picture
Picture
Give this a try. Send it to your board and see if your light blinks at different brightnesses. 
Proudly powered by Weebly
  • Home
  • 2025 RCC Camp
    • Day 1: Basic Coding >
      • Button Control
      • Multicolor LED
      • Fading multicolor led
      • Melody (sound)
    • Day 2: Servos and Potentiometers >
      • DC Motor
      • Ultrasound
      • Potentiometer and Motors
      • 2 servo control >
        • Analog Stick Control
      • PIR Motion Sensor
      • IR Light Proximity Sensor
    • Day 3 Making an ECG/EKG! >
      • ECG/EKG health lesson
      • OLED Screen Basics
      • Pictures to OLED
      • BPM on OLED
    • Day 4: Measuring Pulse >
      • Scrolling Screen Graph
      • How the body absorbs light
      • Screen Pictures
      • IR Temp Sensor And Screen
    • Day 5: Finishing up/Show >
      • IR Light Proximity Sensor
      • PIR Motion Sensor
      • CO2 Sensor
      • Ultrasound distance sensor
  • The Teachers
  • Our Partners
  • Archive
    • 2024 Health-STEM Coding Camp >
      • Home (2024)
      • The Teachers
      • Day 1: Basics and Lights
    • 2024 Coding/Robotics Camp >
      • Day 1: Basic Coding >
        • Saving your codes
        • Engineering design
      • Day 2 Servos >
        • 2 Servos, one potentiometer
        • Multicolor LED >
          • Fading multicolor led
    • Pictures from prior years
    • 2023 3D Design Camp >
      • Day 1: 2D design
      • Day 2: 3D design basics
      • Day 3: Constraints
    • 2023 Health-STEM Coding Camp >
      • PreAcademy prep
      • Day 1: Basics and Lights >
        • Multicolor LED
        • Button Control
      • Day 2: Ultrasound >
        • Ultrasound Health Lesson
        • Supplement Melody
        • Supplement: Servo >
          • Potentiometer and Motors
          • 2 servo control
      • Day 3: Measuring Pulse >
        • How the body absorbs light
        • OLED Screen Basics >
          • Scrolling Screen Graph
      • Day 4 Making an ECG/EKG! >
        • ECG Health Lesson
        • Pictures to OLED
        • BPM on OLED
      • Day 5: Finishing up/Show
    • 2021 STEM Camp (HS) >
      • The Teachers (2021)
      • PreAcademy prep
      • Day 1: Basics, Lights, and Temperature Sensor >
        • Day 1 Supplement: Measure Temperature
        • Day 1 Supplement: IR Temp Sensor
        • Day 1 Supplement: Identifying Resistors
        • Supplement: Controlling A Servo
      • Day 2: Measuring Pulse >
        • How the body absorbs light
        • IR Light Proximity Sensor
        • PIR Motion Sensor
      • Day 3 Supplement: OLED Screen Basics >
        • Display Screen Temperature
        • Scrolling Screen Graph
      • Day 4: Finishing up/Show
    • 2021 STEM Camp (MS) >
      • PreAcademy prep
      • Day 1: Basics, Lights, and Temperature Sensor >
        • Day 1 Supplement: Identifying Resistors
        • Day 1 Supplement: Measure Temperature
        • Day 1 Supplement: IR Light Proximity Sensor
      • Day 2: Ultrasound >
        • Day 2 Supplement: IR Temp Sensor
        • Day 2 Supplement: Controlling A Servo
      • Day 3: Measuring Pulse
    • 2020 STEM Camp
    • 2018 Lessons
    • 2017 Camp
  • Contact Us!