1/16
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
GND
negatively-charged pin
3.3V and 5V pin
positively charged pins
1-10+ (digital pins)
input/output
push button
is a mechanical device
used to control an electrical circuit in
which the operator manually presses a
button to actuate an internal switching
mechanism.
digitalRead
checks
the voltage level on a digital
input or the readings. To know
what pin to check
button Status
variable used to store the state of the
pushbutton. It is declared as an
integer and initialized to 0.
int led = 2;
int button = 3;
int buttonStatus ;
full int coding for button
void setup ()
{
pinMode (led, OUTPUT);
pinMode (button, INPUT);
}
full void setup coding for button
void loop ()
{
buttonStatus = digitalRead (button) ;
if (buttonStatus == HIGH)
{
digitalWrite (led, HIGH);
delay (1000);
}
else{
digitalWrite (led, LOW);
}
}
full void loop coding for button
If Statement
compares two things and it
determines whether the comparison is true or false.
When comparing two things in programming, you use two equal signs
==
Else Statement
happens if the original condition is not met
piezo
is an electronic device that produces a voltage that when a
vibration or a mechanical strain is applied, it will be physically deformed.
When a voltage is applied to a _____, it vibrates and produces a sound.
_____________ may be used to detect as well as play tones.
piezoelectric disc
thin metal plate that
vibrates which creates a buzzing
sound
lead type and pin type
2 types of piezo buzzer
int piezo = 2;
full int coding for piezo buzzer
void setup ()
{
pinMode (piezo, OUTPUT);
}
full void setup coding for piezo buzzer
void loop ()
{
tone (piezo, 200);
delay (50);
noTone (piezo);
delay (50)
}
full void loop coding for piezo buzzer