Functions
Experiment #5 from Vernier Coding Activities with Arduino®: Analog Sensors
- Subject
- Engineering
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.
- Call toll-free: 888-837-6437
- Chat with Us
- Email support@vernier.com
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.