Pre-Lecture Prep and Pre-Quiz
Please read up to "in class work" and complete the pre-quiz before class. Link on Moodle.
Announcements
- Homework 1 is due today!
- Homework 2 is due next Tuesday at 11:40am.
- Quiz policy: you get 100% in points for participation so long as you get 50% of problems correct
- Please answer piazza poll
- Office hours and wizard sessions:
- Delano: Mondays at 3pm-5pm (same zoom link as lecture), or by appointment
- Cheever: check his schedule
- Wizard sessions: Sunday 1-3pm EDT, Monday 7-9pm EDT (zoom link on moodle)
Learning Objectives/Outcomes
In this lecture, you will:
- Review notes about:
- the truth tables for the logical operators NOT, AND, OR, and XOR
- the definition of a variable, and how to set them up in C
- Work with Prof. Delano to complete in class examples of counting button presses
- Complete your own set of in class examples and start on the homework
By the end of this lecture, you should be able to...
- Use conditionals with logical NOT (!), logical AND (&&), and logical OR (||) operators to control neopixel colors depending on the state of the left and right buttons
- Count button presses using boolean variables
- Use comparison operators (>=, <=, ==, !=) and a variable stored in a byte to control neopixel colors based on a number of button presses
Logic Operators
In Lecture 2, we learned about conditionals, how they are either true or false, and how we can use them with buttons to control neopixel states. We also learned about the ! operator (logical NOT), which takes a true condition and changes it to false and vice versa. We can represent logical NOT in what is called a truth table: