Skip to content

stcline/I2R_Lab_3.6-Toggle_Switch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Arduino 3.6-Toggle Switch

In this assignment you will again use digital sensors as input devices. In this example though, you will make a toggle switch.


Step One: Build the Circuit

Build your button circuit according to this schematic:

Capture

Add a second circuit with a resistor and an LED.

Step Two: Write the Code

If needed, review the Arduino Reference page on digitalRead(). You should also review Serial.println() and the if() else conditionals as you will need to know how to print something and control an actuator based on the state of the button.

  1. For starter code, use your previous work with the button.
  2. Modify the code so your sketch does the following:
    • The button switches on or off when the button is pressed and it stays on or off. This is a true toggle switch.
    • The Serial Monitor displays a message every time the LED state changes so that it says "ON" or "OFF" to match the LED.

Use the video below as a reference.

Make sure your prototype behaves the same way as the one in the video. As in the previous assignment, make a new file here on GitHub containing your code.

https://www.youtube.com/watch?v=VdB4GWeVkvY

Step Three: Debug and Submit

Make sure your prototype behaves the same way as the one in the video. As in the previous assignment, make a new file here on GitHub. Name it 3.6_Toggle_Switch.ino and Commit it to the repository.

REMEMBER: THIS ASSIGNMENT REQUIRES BOTH A VIDEO OF YOUR PROTOTYPE SUBMITTED ON CANVAS AND CODE SUBMITTED ON GITHUB

About

Create a toggle switch with a pushbutton

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages