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 (A)
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 (A)
True or false: The open curly bracket, {, begins the setup code?
True or false: The open curly bracket, {, begins the setup code?
True (A)
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?
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?
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?
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?
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?
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?
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?
Flashcards
What is a comment in Arduino code?
What is a comment in Arduino code?
Lines starting with '//' are comments for humans and ignored by the Arduino.
What happens to code within '{}'?
What happens to code within '{}'?
Code inside curly brackets '{}' runs once at the start of the program.
What does '{' signify in code?
What does '{' signify in code?
The opening curly bracket '{' marks the beginning of the setup code block.
How often does loop() run?
How often does loop() run?
Signup and view all the flashcards
What does a complete statement tell the Arduino?
What does a complete statement tell the Arduino?
Signup and view all the flashcards
What does the code generally indicate when it mentions the term 'led'?
What does the code generally indicate when it mentions the term 'led'?
Signup and view all the flashcards
How many times does setup code run?
How many times does setup code run?
Signup and view all the flashcards
What does pinMode(13, OUTPUT) do?
What does pinMode(13, OUTPUT) do?
Signup and view all the flashcards
For how long does 'loop()' run?
For how long does 'loop()' run?
Signup and view all the flashcards
Does Arduino read comments?
Does Arduino read comments?
Signup and view all the flashcards
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.