276°
Posted 20 hours ago

FRANZIS 55103 Raspberry Pi Advent Calendar, Build and Program a Nativity Scene in 24 Days, Includes 52 Page Manual, No Soldering

£9.9£99Clearance
ZTS2023's avatar
Shared by
ZTS2023
Joined in 2023
82
63

About this deal

Let it Glow is our brand new 12-day Maker Advent Calendar dedicated to all things blinky - things that light up, flash, illuminate

Now fit your PIR to the top of the mini breadboard in the orientation shown in the image above (with the 3.3V pin to the left) as shown below: If you're curious, try the very short code below to see what epoch currently looks like: import time

Activity 4: Festive Jingle!

reading = potentiometer.read_u16() # Read the potentiometer value and set this as our reading variable value This initial simple code uses just the first button. The code includes our usual imports and pin setup, then starts a while loop. The while loop contains an if statement that looks for a HIGHsignal ( 1) on GPIO 13. This is because GPIO pins with no pull down (or pull up) can be ' floating' between 0V and 3.3V - ' pulling down' the pin to 0V ensures it's always LOW to start with. The example below uses a function called playtoneto handle all of the volume changes, delays and notes. All you have to do is add the arguments for each.

The frequencyhere changes the toneof the buzzer - we find that our ears can detect changes in the tone when using values between 10 and 10000. You also need to keep an eye on the jumper wires as they like to escape from breadboards sometimes! The Code We’re going to install software called Thonny, which will allow us to program the Pico with MicroPython.We have included a 50/50 split between blinky components and control components (we alternate each day) Try changing both of the time.sleep values to different numbers and see what happens. It should change the speed of the flashing LEDs.

Imagine you’re bouncing a ball whilst your friend counts how many bounces you’ve completed. Your condition might be “ bounce the ball until you count five bounces”. After five bounces, you would stop. For new coders - The included Pico H and project parts combined with the easy-to-follow instructions, clear example code and helpful wiring diagrams make this perfect for anyone wanting to get started with the Raspberry Pi Pico, programming and electronics.

Activity 5: Toggling with buttons

That last activity included a lot of detail so we're going to leave it there for today and not overload your fresh coder brains! That works fine...but it's a bit of a pain to update all of those lines every time we want to adjust the flash speed! Instead we can create a variable and assign it a name such as ' mydelay' and give it a value, say 1.

Let's add our other buttons into the code and change our if statement to make it watch for any of them being pressed.

In our example below our variable is called counter. We create this before the while loop and set an initial value of 1. For Maker Advent Calendar veterans - If you enjoyed the 12 Projects of Codemas last year, we think you're going to love the blinky theme of Let it Glow! With a whole new set of exciting components to add to your collection, including LEDs, displays and new control components, you can enjoy another fun festive season of coding and making. Everything you need is included

Asda Great Deal

Free UK shipping. 15 day free returns.
Community Updates
*So you can easily identify outgoing links on our site, we've marked them with an "*" symbol. Links on our site are monetised, but this never affects which deals get posted. Find more info in our FAQs and About Us page.
New Comment