CxD Archive
CxD 2022 Summer Workshops
CxD 2022 Summer Workshops
  • Computing by Design 2022 🚀
  • Cross-Disciplinary Workshops
    • CS for Math & Science: Charting Data
    • CS for Language Arts: Natural Language Processing
    • Build a Flash Card App Study Guide for Any Course
  • Programming Workshops
    • Trivia App
      • Workshop Prep
      • Live Zoom: Mon 1:00 pm ⏰
      • Programming Warm-Up ⏱
      • Teacher Insights
      • Program a Trivia App ⏱
      • Live Zoom: Wed 11:30 am ⏰
      • Workshop Deliverables
    • Chatbot
      • Workshop Prep
      • Live Zoom: Mon 1:00 pm ⏰
      • Programming Warm-Up ⏱
      • Teacher Insights
      • Program a Chatbot ⏱
      • Live Zoom: Wed 2:30 pm (updated) ⏰
      • Workshop Deliverables
    • Data Visualization
      • Workshop Prep
      • Live Zoom: Mon 1:00 pm ⏰
      • Programming Warm-Up ⏱
      • Teacher Insights
      • Program for Data Viz ⏱
      • Live Zoom: Wed 2:30 pm ⏰
      • Workshop Deliverables
    • Robotics
      • Workshop Prep
      • Live Zoom: Mon 2:30 pm ⏰
      • Programming Warm-Up ⏱
      • Teacher Insights
      • Program a Robot ⏱
      • Live Zoom: Thur 11:30 am ⏰
      • Workshop Deliverables
    • Video Game
      • Workshop Prep
      • Live Zoom: Mon 2:30 pm ⏰
      • Programming Warm-Up ⏱
      • Teacher Insights
      • Program a Video Game ⏱
      • Live Zoom: Thur 1:00 pm ⏰
      • Workshop Deliverables
    • Internet of Things
      • Workshop Prep
      • Live Zoom: Mon 2:30 pm ⏰
      • Programming Warm-Up ⏱
      • Teacher Insights
      • Program for IoT Part 1 ⏱
      • Program for IoT Part 2 ⏱
      • Program for IoT Part 3 ⏱
      • Live Zoom: Thur 2:30 pm ⏰
      • Workshop Deliverables
  • Innovation Workshop
    • Prepare a Full CS Experience
  • PBLWorks 101 Workshop
    • Managing CS Projects in Class
  • resources
    • Computing by Design Home
Powered by GitBook
On this page
  • Introduction
  • Claiming Your IoT Device
  • IoT Tutorial - Programming the Device
  • Reading Temperature and Humidity
  • Controlling an LED
  • Reference Material for the IoT Kit Hardware
Export as PDF
  1. Programming Workshops
  2. Internet of Things

Program for IoT Part 1 ⏱

Getting Started with Programming the IoT Device

PreviousTeacher InsightsNextProgram for IoT Part 2 ⏱

Last updated 2 years ago

Introduction

Claiming Your IoT Device

IoT Tutorial - Programming the Device

We will use the Particle tutorial for the IoT kit linked below to guide us, but the videos will deviate a bit to demonstrate things using the web programming environment. Ultimately we want to get familiar with the hardware, inputs, sensors, and programming. ★ Post questions and successes in our Slack channel as you move along.

Understanding LED Status Signals

Reading Temperature and Humidity

1. Create a new program in Particle build.

2. Connect the temperature and humidity sensor to D2, and have your Argon device connected.

3. Include the "GROVE_TEMPERATURE_AND_HUMIDITY_SENSOR" library in your program.

4. Copy and paste the code below (except of the #include part) into your program.

// This #include statement was automatically added by the Particle IDE.
#include <Grove_Temperature_And_Humidity_Sensor.h>

DHT dht(D2);

double temp_dbl, humidity_dbl;

void setup() {
    Serial.begin(9600);

    dht.begin();
    
    Particle.variable("temp", temp_dbl);
    Particle.variable("humidity", humidity_dbl);
}

void loop() {
    float temp, humidity;

    temp = dht.getTempFarenheit();
    humidity = dht.getHumidity();

    temp_dbl = temp;
    humidity_dbl = humidity;

    delay(10000);
}

5. Save, Verify, and Flash the code to the Argon board.

6. Open the Console from particle build, select "my devices", and select your Argon.

7. Get the temp and humidity variables to check if all is working.

That's it for this step 🎉. If you are having any problems, no worry, post in our slack channel. Please share your code when it makes sense or create videos.

Controlling an LED

Instructions coming soon...

1. Create a new program in Particle build.

2. Connect the Grove Chainable LED to A4, and have your Argon device connected.

3. Include the "Grove_ChainableLED" library in your program.

4. Copy and paste the code below (except of the #include part) into your program.

// This #include statement was automatically added by the Particle IDE.
#include <Grove_ChainableLED.h>
ChainableLED leds(A4, A5, 1);

void setup() {
    leds.init();
    leds.setColorHSB(0, 0.0, 0.0, 0.0);
    Particle.function("toggleLed", toggleLed);
}

void loop() {
    // toggleLed("");
}

int toggleLed(String args) {
    leds.setColorHSB(0, 0.0, 1.0, 0.5);
    delay(500);
    leds.setColorHSB(0, 0.0, 0.0, 0.0);
    delay(500);
    return 1;
}    

5. Save, Verify, and Flash the code to the Argon board.

6. Open the Console from particle build, select "my devices", and select your Argon.

7. Call the toggleLed function to pulse the LED one time.

That's it for this step 🎉. If you are having any problems, no worry, post in our slack channel. Please share your code when it makes sense or create videos.

Reference Material for the IoT Kit Hardware

This video steps you through claiming a particle device and setting up WIFI. You will want your mobile phone to complete this with the Particle App installed. Apple: Android:

This link comes in very handy for interpreting the different status LED signals you may get from time to time.

We are covering concepts from the Particle Variables: measure temperature & humidity section of the tutorial.

We are covering concepts from the Particle Functions: controlling a Chainable LED section of the tutorial.

https://apps.apple.com/us/app/particle-iot/id991459054
https://play.google.com/store/apps/details?id=io.particle.android.app&hl=en_US
https://docs.particle.io/troubleshooting/led/argon/
https://docs.particle.io/quickstart/isk-project/#particle-variables-measure-temperature-amp-humidity
https://docs.particle.io/quickstart/isk-project/#particle-functions-controlling-a-chainable-led
https://docs.particle.io/quickstart/isk-project/#appendix-grove-sensor-resources
LogoIoT Starter Kit | Quickstart
LogoIoT Starter Kit | Quickstart