Attention: Safety Recall of Vernier Go Direct Charge Station. Click to learn more.

Shop

Experiments​

Introduction

Consider the following sketch:

void setup () {

     Serial.begin(9600);

     printHeader();

}

void loop () }{

     calculateTime();

     readData();

     printData();

}

Hopefully you find its streamlined code structure to be easy to read and understand. You can work towards creating code like this with the use of functions. 

Objectives

  • Learn formatting for creating and calling a function
  • Distinguish between local and global variables
  • Explore how functions can streamline your code, making it easier to understand and more efficient

Sensors and Equipment

This experiment features the following sensors and equipment. Additional equipment may be required.

Ready to Experiment?

Ask an Expert

Get answers to your questions about how to teach this experiment with our support team.

Purchase the Lab Book

This experiment is #5 of Vernier Coding Activities with Arduino®: Analog Sensors. The experiment in the book includes student instructions as well as instructor information for set up, helpful hints, and sample graphs and data.

Learn More

Vernier Coding Activities with Arduino
SAVE/SHARE YOUR CART