Blink LED in C/C++ on the Raspberry Pi Pico [Linux SDK Setup]

Поделиться
HTML-код
  • Опубликовано: 19 авг 2024
  • In this video, I'll show you how to set up a build environment for your C/C++ RP2040 projects in Linux. Using CMake and Make, learn how to compile code and upload it to the RP2040 Raspberry Pi Pico. The Raspberry Pi Pico build environment that comes with the pi-pico-sdk makes developing and uploading files to the RP2040 extremely easy.
    Today, we're going to talk about the RP2040 SDK, and how to setup and build programs for your RP2040. We'll write the blink LED example in C, and flash it to the RP2040.
    Learn how to use the Raspberry Pi Pico SDK to create a custom build environment and do the Blink LED tutorial in C.
    Buy the RP2040: amzn.to/3uISUGn
    Join us on Discord!: / discord

Комментарии • 62

  • @chuckmuckamuck8001
    @chuckmuckamuck8001 3 года назад +18

    I am more excited about a blinking light than I probably should be, thanks!

  • @francisstapp1583
    @francisstapp1583 Год назад +3

    this tutorial saved the one of the two brain cells i have left

  • @suvirkumar3237
    @suvirkumar3237 Год назад +1

    Cool a very nice and concise guide to getting started with cmake and bcc. Appreciate your hard work.

    • @LowLevelLearning
      @LowLevelLearning  Год назад

      Glad you liked it

    • @XStance7
      @XStance7 Год назад

      @@LowLevelLearning How can we set this up for Mac M1? Any Advice?

    • @minhajsixbyte
      @minhajsixbyte 11 месяцев назад

      @@XStance7 you can start with looking up for the equivalent brew packages

  • @Qw3r3wQ
    @Qw3r3wQ 3 года назад +12

    From where do you get this : set(PICO_EXAMPLES_PATH ${PROJECT_SOURCE_DIR}) ?
    and you did not mention installing arm-none-eabi-gcc-cs-c++ ;)

  • @saffiervanderhoef2547
    @saffiervanderhoef2547 10 месяцев назад

    good video relatively easy to follow and understand

  • @anthonyheak3479
    @anthonyheak3479 5 месяцев назад

    Thank you, it was very explained!

  • @JimMaz
    @JimMaz Год назад

    Very well explained and pertinent

  • @jamesbailey3131
    @jamesbailey3131 3 года назад +10

    Great tutorial, clear and professional. Have you done anything with the little OLED displays SSD1306 - I've got a 128x32 and a 128x64 but the few examples I can find for the Pico are all C++ and I would really like to stick to C if possible.

    • @LowLevelLearning
      @LowLevelLearning  3 года назад +1

      I haven't, but I think theyre controlled over I2C. I plan to do SPI and I2C tutorials soon. Thanks for watching!

  • @yahmk3978
    @yahmk3978 2 года назад +1

    Thank you very much!

  • @fusca14tube
    @fusca14tube 3 года назад +5

    First of all, thank you! Great explanation. But, what about Pico C LED blink bare-metal video, just like you did with Arduino? :)

  • @lottalava
    @lottalava 2 года назад

    awesome tutorial, thank

  • @jackyli6716
    @jackyli6716 3 года назад +1

    great tutorial!

  • @renechawy
    @renechawy 3 года назад +1

    Mr LLL, a little ARM ASSEMBLY example in the future ? Currently no videos on Pico just Rpi-board:
    $ as
    $ ls
    $ gdb (or GDB server)
    But those for OS-RPI

  • @barchilsaid3001
    @barchilsaid3001 3 года назад +1

    Thanks :)

  • @blup737
    @blup737 Год назад +1

    bro how to learn Raspberry Pi Pico programming (c/c++)

  • @michajoko7534
    @michajoko7534 2 года назад +1

    How I can mount the raspberry pi pico filesystem without unplug and plug into the USB Port (with holding the BOOTSEL button), like in your video?

    • @minhajsixbyte
      @minhajsixbyte 11 месяцев назад

      i am looking for this too. have you been able to solve it?

  • @roryjones6483
    @roryjones6483 2 года назад +4

    What’s the IDE you’re using? Sublime?

  • @magnum_dingus
    @magnum_dingus Год назад +1

    "I'll put this link in the description." *doesn't*
    What a chad.

  • @raisagorbachov
    @raisagorbachov Год назад +2

    A "little" more complicated... I decided to stick with Python on the Pi and C++ on the Arduino as a result of seeing that "little" extra complication.

  • @HitAndMissLab
    @HitAndMissLab Год назад

    it would be nice if you made this video few minutes longer and explain how you connected into the Raspberry Pico and how you connected Pico to the web etc. Otherwise great video.

    • @slzckboy
      @slzckboy Год назад

      pico cant connect to the web.What he didnt makeclear was that he was running the commands from either a linux pc or a rasberry pi4 etc.However i did manage to blink an LED from watching this so i think he did ok.

  • @parsishashank
    @parsishashank 3 года назад

    It will be helpful if you could explain connection of hardware

    • @jyvben1520
      @jyvben1520 3 года назад +4

      pico -> (usb mini) usb cable with standard usb 2 type A in pc/laptop/raspberrypi

  • @warrenyoung5282
    @warrenyoung5282 2 года назад

    I followed your youtube. I get an error "fatal error # include cstdlib no such file or directory" I have tried using the raspberry pi sdk instructions to run blink and get the same error. Where should I look for this file.

  • @carbonanimationproductions6537

    is there a tutorial for c++ and raspberry pi robotics? i really wanna learn

  • @unoseemek3490
    @unoseemek3490 Год назад +1

    not sure if the software has changed over time but could you explain what you mean when you say to install cmake? anytime I try to put in "sudo snap install cmake" my chromebook just tells me "sudo: snap: command not found" (6:16 in the video)

    • @michaelsnater2345
      @michaelsnater2345 Год назад

      You need to install cmake. Snap is the way he does that. There are others. For example I typed this command into my terminal(Msys2): pacman -S mingw-w64-x86_64-cmake

    • @hoangnguyen6162
      @hoangnguyen6162 6 месяцев назад

      Ah that's because you don't have the `snap` installed.
      If `cmake` is somewhere in your package repositories. With sudo priviledge, run the command for installing `cmake` using your GNU/Linux distro's package manager. For example `apt install cmake` (on Debian GNU/Linux and derivatives) or `pacman -S cmake` (for arch btw and derivatives).

  • @michaelsnater2345
    @michaelsnater2345 Год назад

    My 'cmake ..' command did create a lot of things.....makefile not being one of them. Why do you think that is?

    • @minhajsixbyte
      @minhajsixbyte 11 месяцев назад

      is the CMakeLists.txt exactly same as it is shown in the video?

  • @mytechnotalent
    @mytechnotalent 3 года назад

    Do you know of a good NRF2401 C ONLY driver and example for the Pico? I have seen C++ versions but really look for a pure C one with a good send/recv example.

  • @jacobholder8188
    @jacobholder8188 2 года назад +1

    Which Linux distro is he using for these tutorials? I’m at a loss.

    • @minhajsixbyte
      @minhajsixbyte 11 месяцев назад

      distro does not matter. he is using ubuntu. it might look different because he is not using any "traditional" desktop environments. its all the same under the hood.

  • @jvernice
    @jvernice 2 года назад

    My CMakeList.txt looks nothing like yours when I downloaded the examples. Was this completely re-written by you? I am new to Cmake. Been using Arduino and venturing into Raspberry Pi Pico

  • @larsclausen3586
    @larsclausen3586 2 года назад

    I got to the 7:32 mark, the make moment, and the first line looks like in the video, but then after that about 200 errors. The first line says Assembler messages, then next line S89: Error unknown pseudo-op: '.syntax', and then about 199 more of the same. Any ideas? Thanks

    • @larsclausen3586
      @larsclausen3586 2 года назад

      Tried again from scratch this time on a newly fresh install of a raspberry pi 4. This time i got only about 70 errors. All goes fine until 93% progress, then it says pico_standard_link/new_delete.cpp.obj and then follow 70 errors of stuff not defined.

  • @mitchellmigala4107
    @mitchellmigala4107 2 года назад

    I have gone through this over and over what a nightmare. In the end the make fails. I deleted everything several time and went through again. everything works up until make. Then I get a whole bunch of errors when it hits elf2uf2

    • @unoseemek3490
      @unoseemek3490 Год назад

      same, have you figured out how to solve this yet?

    • @mitchellmigala4107
      @mitchellmigala4107 Год назад

      @UNOSEEMEk yes, I did but I can't remember what it was. The process for using C or C++ is a joke or at least was 9 months ago. I gave up and started using circuit python and micro python with thonny. It is much easier to get your code built and running on them with that.

    • @minhajsixbyte
      @minhajsixbyte 11 месяцев назад

      arm-none-eabi-newlib
      check if anything changes after installing this package.

  • @michaelchu5423
    @michaelchu5423 2 года назад +1

    I am new to code in C. I cannot run "sudo snap install cmake". How to install 'snap' first?

    • @duckyblender
      @duckyblender 2 года назад +1

      sudo apt install snapd

    • @minhajsixbyte
      @minhajsixbyte 11 месяцев назад

      Its not a C thing. Its a ubuntu thing.

  • @laptrinhdientu
    @laptrinhdientu 3 года назад

    Thanks. Can you make a tutorial with window OS ♥

  • @Dylan-we5dz
    @Dylan-we5dz 9 месяцев назад

    i think i bricked it :(

  • @henkoegema6390
    @henkoegema6390 3 года назад +2

    :-)

  • @Qw3r3wQ
    @Qw3r3wQ 3 года назад +1

    Mmmmm, tasty...

  • @robotboy3525
    @robotboy3525 Год назад

    Hi, I'm curious. I really want to know how your CMakeLists.txt is much different from the
    one in the git repository. How did you came about to write this ??
    Anyways, the one in the git repository didn't work for me but yours worked perfectly
    and i made no modifications to my blink.c
    I have actually looked up in the Raspberry Pi Pico C/C++ SDK pdf and didn't find any info on how
    you set your CMakeLists.txt to be the way it is.
    Eventually, i will be writing my own project and i will need to write my own CMakeLists.txt
    to suit my codes.
    Thanks a lot for your tutorial. It's my first time getting into c/c++ baremetal armeabi.. gcc stuff
    and i wouldn't have been able to get this going without this tutorial

  • @sledgex9
    @sledgex9 2 года назад +2

    Some criticism:
    1. Where's the C++ ? This is pure C.
    2. Why instruct cmake (CMakeLists.txt) that your project uses C++ and ASM when in fact it only uses C? You don't need to set the C++ standard either if you don't use C.
    3. Type safety! Why define GPIO_ON/GPIO_OFF as 1/0 instead of true/false? Match the API signature.
    4. Let me post a C++ modification that also gets rid of using the preprocessor for the defines:
    #include
    namespace { //anonymous namespace, makes variables local to this translation unit. Same as defining them as static.
    constexpr bool GPIO_ON = true;
    constexpr bool GPIO_OFF = false;
    constexpr unsigned int LED_PIN = 25;
    }
    int main() {
    //blah
    }