Grace's Blog

This is documentation of my work and questions throughout the semester

View the Project on GitHub gracethorn/gracesblog

Week 2 Lab (Lesson 5 Digital Images)

Overview and Notes

Push Switches

Press or flip lever, connect two contacts so electricity can flow

(Small tactile switches used in labs have 4 connections)

LED- shorter negative leg on the left

Code Explaination

‘ledPin’ is output pin

‘buttonApin’ is switch near top of breadboard

‘buttonBpin’ is other switch nearer bottom

The set up function defines the ledPin as being an OUTPUT as normal, since we have 2, the pinModes must be designated and codes seperate

The pit mode of INPUT_PULLUP means that the pin is to be used as an input

The loop contains two ‘if’ statements, one for each button. each has an ‘digitalRead’ on appropriate input

If button is pressed, corresponding input is LOW

First Lab Attempt (Jan 20)

Here is my completed set up on the breadboard:

LED Set Up

Question: The light turns on when clicking red button on COM3, but switches are not working and controling the light

LED Light On