Arduino Intermediate Skills for EnviroDIY

Overview

Teaching: 0 min
Exercises: 120 min
Questions
  • What is an Arduino library and how do I use it?

  • What intermediate code structures are critical to data logging?

Objectives
  • Learn how to use external libraries, which leverage the power of C++.

  • Learn how to use a C++ class, using a constructor function, leveraging Object Oriented Programming.

  • Learn how Arduinos can multi-task using timing functions.

Prerequisites

In Episode 2, we continue to introduce you to Arduino concepts and skills necessary for utilizing ModularSensors. We again do this through online tutorials.

Actively Participate

We strongly recommend that you actively participate in the activities in each tutorial because you will need to be comfortable with both physical connectivity to an Arduino and code edits prior to using EnviroDIY Modular Sensors Library.

Episode 2: Arduino Intermediate Skills for EnviroDIY

Arduino Libraries by Tyler Cooper

All About Arduino Libraries by Bill Earl

Multi-tasking the Arduino Part 1 by Bill Earl

void loop()
{
  if(digitalRead(21) == HIGH)
  {
     led1.Update();
  }

  led2.Update();
  led3.Update();
}

Solution

The solutions to the advanced blink sketches are hidden in the LearnEnviroDIYcode repository. You will be downloading the entire repository in Eposode 1.5, but if you want to check your work here are the solutions:

Learning Resources

  • As you dive deeper into Arduino programming, you might want to have these references handy and open in a separate tab to look up the details on any code element that you come across:
  • There are many other Arduino learning resources online. Googling code snippets will soon become your friend!

Key Points

  • Arduino libraries offer an amazing array of functionality, by providing higher-level functions.

  • Many libraries, including ModularSensors, use Object Oriented Programming, in which a class of objects is defined. A special type of function called a constructor creates an object of that class.