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

To make our if statement look for ' less than or equal to', we use a <= operator, like this: if reading <= 20000 Although the code example below is longer than some of the others we've shown you, there's nothing scary or new here (minus the notes above). We're importing, setting up pins and PWM, creating some variables then using a while loop with if statements - all things you're good at now! Welcome to day four of your 12 Projects of Codemas Advent Calendar. Today we’ll be playing with analogue inputs using a potentiometer and combining this with some of the components we've already played with.

Thonny can be used with a range of development boards, so we need to tell Thonny that we are using a Raspberry Pi Pico.So why is this better? Let's look at two examples below where we want to print a set of strings three times. Both of the following examples have the exact same outcome (try them yourself) however the code using functions is shorter. 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. You'll need to install the Thonny IDE - we guide you through the installation and setup of the Pico on the first day. Now for something a little more advanced, but really cool - we're going to fade an LED in and out using our potentiometer! The second line is setting up one of the pins to allow us to use it in our code. This sets up GPIO25 with the name ‘ onboardLED’. We use Pin.OUT at the end there to tell MicroPython to set this pin as an output.

Please hold the sensor at the edges of the green PCB when fitting as it is a delicate component! Important! Sensor Orientation!We're using Windows (11) in the example projects using the Thonny IDE. Thonny is also available for MAC and Linux machines and there should be very little difference from the instructions. Chromebooks are not supported.

The time module allows you to program delays in your code, making it wait for seconds or fractions of seconds before continuing. It’s another fundamental module you’ll use in most of your projects. The Code The readings from the potentiometer are between 0 and 65535, and our buzzer duty (volume) uses the same range, so we can use the potentiometer readings to directly control the duty - handy!I am way behind the pace here because I got this as a Christmas gift and I am now working my way through. I’m having immense fun and learning a huge amount. Here is the code for a different game using the same sensors. It is a Formula 1 start time reaction game, for the F1 fans out there. Copy that code to your top-right panel, then hit the run button. The LED should light up – hooray – you’ve controlled your first physical component!

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