Podcast
Questions and Answers
True or false: Any line in a program starting with // is meant to be read by the user only and is ignored by the Arduino?
True or false: Any line in a program starting with // is meant to be read by the user only and is ignored by the Arduino?
True
True or false: The code between the curly brackets, {}, will run once when the program starts?
True or false: The code between the curly brackets, {}, will run once when the program starts?
True
True or false: The open curly bracket, {, begins the setup code?
True or false: The open curly bracket, {, begins the setup code?
True
True or false: The loop() statement will run once the Arduino is powered on and then repeat until it is powered off?
True or false: The loop() statement will run once the Arduino is powered on and then repeat until it is powered off?
Signup and view all the answers
True or false: The statement 'This tells the Arduino to set led' is incomplete in the given text?
True or false: The statement 'This tells the Arduino to set led' is incomplete in the given text?
Signup and view all the answers
True or false: The mention of 'led' in the sketch will refer to pin 13?
True or false: The mention of 'led' in the sketch will refer to pin 13?
Signup and view all the answers
True or false: The setup code will run once when the program starts?
True or false: The setup code will run once when the program starts?
Signup and view all the answers
True or false: The code 'This tells the Arduino that pin 13 is an output pin' indicates that pin 13 is an input pin?
True or false: The code 'This tells the Arduino that pin 13 is an output pin' indicates that pin 13 is an input pin?
Signup and view all the answers
True or false: The loop() statement will repeat until the Arduino is powered off?
True or false: The loop() statement will repeat until the Arduino is powered off?
Signup and view all the answers
True or false: The code 'This is a comment' is meant to be read by the Arduino?
True or false: The code 'This is a comment' is meant to be read by the Arduino?
Signup and view all the answers
Study Notes
Arduino Sketch Basics
- Lines beginning with
//
are comments for users, ignored by Arduino; useful for code documentation. - Multi-line comments can begin with
/*
and end with*/
, allowing explanation over several lines.
Variable Declaration
-
led
is defined as an identifier for pin 13; using this name throughout the code simplifies referencing the pin.
Setup Function
- Code within curly brackets
{}
followingsetup()
runs once upon program startup. - The command
pinMode(led, OUTPUT);
designates pin 13 as an output pin, enabling power to an LED.
Loop Function
- The
loop()
function initiates an infinite cycle of code execution after startup. - Code within its curly brackets
{}
executes repeatedly until the Arduino is powered off, facilitating continuous tasks.
Pin Control
- The command
digitalWrite(led, HIGH);
could be used to turn the LED on, whiledigitalWrite(led, LOW);
turns it off.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Description
Test your knowledge of Arduino programming by identifying different components and functions in a given sketch. This quiz will help you understand how to create comments, and learn about the importance of commenting in your code.