User Tools

Site Tools


notes:c4eng:fall2023:projects:ptb2

This is an old revision of the document!


PTB2

switch

The switch used has three connection pins:

  • Connect the central pin to 3.3V, using a 10 KΩ resistor in series
  • Connect one of the outer pins to a GPIO pin, using a 10 KΩ resistor in series
  • Connect the other outer pin to ground

button

Your button(s) should produce an input for the RED, GREEN, and BLUE LEDs. All the buttons should be set to input mode since they're input devices. With that information, I would code the button to the corresponding LED. So Red button to the red LED, blue to blue, and green to green.

multicolor LED

[ptb2] The multicolor LED should output the colors RED, GREEN, and BLUE. With that information , I would personally color code the buttons associated with the specific color desired when the button is pressed. Meaning have a RED button cap for when you want the multicolor LED to output RED, and so on for each color. This just makes it easier to test your code.

if-else

The if else statement essentially means that “ if this condition is true do the following thing, else do this thing instead”. If the condition inside the parentheses evaluates to true , the code inside the if block will execute.

notes/c4eng/fall2023/projects/ptb2.1698228058.txt.gz · Last modified: 2023/10/25 10:00 by stostan2