Project
Status
In Progress
Date Created
October 8, 2024
Author
U
UntitledTools & Skills
electronicsarduinopythoncoding
[CoF] Careers of the Future
Technology
Launch Lab Connection
Competency
STEAM Agency
- If you need more information about setting up Arduino IDE or Python for the Adafruit KB2040 go to this link.
- For Information about functions and other Arduino references go to Arduino's Official references page
Making The Microcontroller
‣
Materials
- Breadboard
- 2 Set of pins
- Adafruit KB2040 Microcontroler
- Soldering machine
- Lead free Solder
- Pliers
‣
Procedure
Link to how to Solder tutorial:
Set Up
‣
Arduino IDE
‣
Arduino IDE Download
‣
Adding the Philhower Board Manager URL
- Once installed, open the Arduino IDE.
- In the Arduino IDE, Go to File > Preferences on Windows or Linux, or Arduino > Preferences on OS X. The Preferences window will open.
- look for the Additional Boards Manager URLs field. You will need to add a URL. Each URL is separated by commas and only need to be added once.
- Copy the following URL: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
- Add the URL to the the Additional Boards Manager URLs field (highlighted in red below).
- Click Okay to save the changes and close Preferences.
- Click on Tools>Board>Board Manager
- In the Boards Manager, search for RP2040. Scroll down to the Raspberry Pi Pico/RP2040 by Earle F Philhower, III entry. Click Install to install it.
- WARNING: Installing the new Library can take a while so do NOT click cancel once it starts installing.
- Once Installation is completed click close to Close the Board Manager.
‣
Add Board Support Package
- In the Tools > Boards menu, you should now see Raspberry Pi RP2040 Boards (possibly followed by a version number).
- Go to the Raspberry Pi RP2040 Boards menu. You will see the available boards listed.
- Look for Adafruit KB2040 in the RP2040 Boards collection!
- NOTE: If there is no serial Port available in the dropdown, or an invalid one appears - don't worry about it! The RP2040 does not actually use a serial port to upload, so its OK if it does not appear if in manual bootload mode. You will see a serial port appear after uploading your first sketch.
- Now you're ready to begin using Arduino with your RP2040 board!
‣
Phyton
fnkjsdnkajdvn ak
💡
Be selective on when you use Headings to ensure that sections can be found.
Arduino IDE Tutorials
‣
Arduino References
‣
How do Breadboards Work
Breadboards are where we are going to build all of our future circuits, so is important to understand how they work. Breadboards have to kinds of rails: 1-Power rails and 2-Electrical contract rails. A bread board consists of positive and negative power rails on each side conected vertically, and a multiple rows of Electrical constact pins called terminal strips conected horizontally. Heres an example:
‣
How To Make a Blinking LED
‣
Materials
- 1 LED
- 2 Jumper Cables
- Adafruit KB2040 (or any other compatible Microcontroller)
- Power Supply Cable (This is what allows you to power the microcontroller using your computer).
‣
Instructions
- Connect the Adafruit KB2040 Microcontroller to the breadboard in the middle like so:
- Conect the microcontroller to your computer
- Navigate in the Arduino IDE menu select the Adafruit KB2040 (This will only work if you have previously set up the board support package, if you haven't refer to this tutorial).
- Now you should see the sketch interphase. These is where all of the coding will occur. There are two main sections: Void Setup and Void loop. The set up section allow us to set pin modes and call other libraries and only happens once. The loop section is where most of the code is written; anything that you write here will be repeated indefinitely from top to bottom until it’s stopped.
Building The Circuit
- take a jumper cable and connect one end to your ground(GND) in the microcontroller. this will be your negative terminal in the circuit.
- take another Jumper cable and connect it to pin 2.;This will be the pin we will be using as positive terminal.
- take an LED and placed in the breadboard going from one bank to the other (LEDs are directional, meaning that they won't work if they are not place in the right orientation. The long leg is the positive side and the short one is the negative. Remember this for the next step).
- Connect each jumper cable to its corresponding LED terminal. Connect the negative/ Ground jumper cable to the negative side of the LED (short leg) and the positive jumper cable to the positive side of the LED (long leg).
- The Circuit is done! Now let’s do some coding!
Code to make the a blinking LED
- Go to the Void Setup section and write the following function: [pinMode( 2, OUTPUT);] With this you are telling the board to “use digital pin #2 as an output”.
- REMAINDER 1 : ALWAYS put semi-comes (;) at the end of a line of code. otherwise Arduino IDE will not understand.
- Go to Void loop and write the following line of code: [digitalWrite( 2, HIGH);] With this you are telling the board to send power to pin #2. Digital pins can only send 2 amounts of power: Full power (HIGH) and no power (LOW). They are like 1 and 0 on binary code or the on/off switch in your room.
- Now, if you upload these instructions to the microcontroller you won't be able to see anything. To make it blink we need to make the LED turn on(HIGH) and off(LOW). To do this add the same line of code as before but instead of (HIGH) set it up for (LOW): [digitalWrite(2, LOW);
- If you upload this you won't be able to see the LED blink because it is blinking way too fast. You need to set a delay between turning the LED on and off and at the end of the of the cycle. To do this write the following line of code in between the HIGH and LOW commands and at the end of the Void loop: [delay(1000);] This will set a 1 second delay between each action.
- If you did the all of the previous steps correctly you should be able to verify your code for errors by hitting the check mark button at the top right corner.
- If you didn't have any warnings you can proceed and upload the sketch to the microcontroller by clicking on the button with an arrow pointing to the right.
- If you did all the previous steps correctly you should have a blinking LED in your breadboard circuit!