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!

Monday June 21 or 28 2021
​The Basics!

Watch this to learn Arduino basics 

 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 is the code that makes the Arduino blink

Picture
One big thing that you may not be used to is that CaPiTal lEttErs maTter! Things change color as you type them correctly. The words like OUTPUT, HIGH, 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 ] . 

Type in the blink code into Arduino IDE.
​If you do not have Arduino IDE yet, directions are in the preacademy prep page. Click here to see the directions. 

Let's Write our first code. 

Step 1: Type up your code following the tips above to get it to look like the picture. 
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) Did you type the curly brackets, {   } 

                             
​If you get no error (bottom box is not orange), then you can move on.

Still having issues? Let your teacher know!​
Picture

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. 
Follow the steps in the picture below if you get the Port Error. 
​
          Open the tools tab, Port, and select the port COM that says 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 if it still does not work and you need help. ​

Learn how to 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. 

Watch this video to learn how to save


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")

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 the example below.

Adding more lines to add blinking complexity. 

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:
Turning "off-board" LED on and off 


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
The 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


​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! 

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!