About this deal
We can decide how long we keep our LEDs ON/HIGH by changing the Duty Cycle. The duty cycle is the percentage of the time that our LED will be ON. The higher the duty cycle, the longer the LED will be ON, and the brighter our LED will appear.
Today we’ll be programming LEDs to light up, flash and display sequences, building on yesterday’s code using GPIO pins to control them. The while True loop then reads the potentiometer value and stores this in our readingvariable, and prints this for us to view in Thonny It doesn't matter which side of the LED the resistor sits , as long as it's there limiting the flow of current for the entire circuit ( take a look at the comment section for an example ). Raspberry Pi Pico Pin Map
Activity 3: Potentiometer Volume Control
Place a resistor between the left leg of each LED and the lower blue channel, like below. We'll be connecting that blue channel to a Ground (-) pin shortly.
The last activity created a game where we tried to hit the highest score possible in 30 seconds. This time we're creating a game with a target to hit within 30 seconds, using our LEDs to indicate how close the player is to beating the game.Please do not disassemble the circuit as we're going to be using it again with the contents in the next box...see you all tomorrow! We have included a 50/50 split between blinky components and control components (we alternate each day) The Duty Cycle sets the volumeof the buzzer. The range is technically 0 to 65535 in MicroPython, however we find that values below 5000 are very difficult for our ears to hear. A duty of 10000 appears to be the sweet spot for our buzzer.