Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use ESP32 with ROS2 and platformio. #1

Open
drinkBr opened this issue Jun 30, 2024 · 3 comments
Open

How to use ESP32 with ROS2 and platformio. #1

drinkBr opened this issue Jun 30, 2024 · 3 comments

Comments

@drinkBr
Copy link

drinkBr commented Jun 30, 2024

I used LED_BUILTIN, which is 2 in most esp32 modules, including wroom. Wroom has two LEDs on board. The red led is power. The blue led is 2. You should see blue led lights up.

I know that the ESP32 has red and blue LEDs. What I want to do is to light up an LED that I have newly connected. I believe that LED_BUILTIN refers to the blue LED built into the ESP32, is that correct?

@hippo5329
Copy link
Owner

hippo5329 commented Jun 30, 2024

You may change

#ifdef LED_BUILTIN
#define LED_PIN LED_BUILTIN
#else
#define LED_PIN 13
#endif

into the pin you connect the LED, say, 4.

#define LED_PIN 4

However, I would suggest you install vscode on your windows and develop remotely to your rpi. I wrote a wiki on this.

https://github.com/hippo5329/micro_ros_arduino_examples_platformio/wiki#development-on-windows-or-linux-desktop-and-use-vscode-remote-development-ssh-to-rpi45

I believe this is the better way for your project. You may fork my repos to create your forks. You will learn the github/vscode/platformio workflow. I know there will be a lot to learn on this. It will pay off and give you good results.

You may start with the Blink example. It is the "hello world" for micro-controller. It should be run when we get a new board.

https://github.com/hippo5329/Blink-platformio

In summary, this is my suggestion,

  1. install vscode to windows. use ssh to connect your rpi4.
  2. fork the Blink, use vscode on windows to clone build and upload on rp4 to esp32.

vscode on windows --> rpi4 --> esp32

  1. After the blue led 2 on esp32 blink. change the LED pin to your new LED and try out. you may commit your change and push it to github. I can review your code and give you suggestion.

Once you get familiar with this work flow, you will work better then ever. enjoy.

Let me know if you need more details.

@hippo5329
Copy link
Owner

You should run "ssh-keygen -t ed25519" on both your windows and rpi4. And add the SSH public key of both to your github. You will use use "SSH" url to clone your forks instead of "HTTPS" when you clone the other people's repos.

You will install platformio and gitlens extensions to your rpi4 though vscode ssh on windows. Vscode on windows is your command center. You can open terminals in vscode on windows to run and launch ros2 on rpi4. A browser (mostly to github.com) and vscode will server your development work.

@hippo5329
Copy link
Owner

I used LED_BUILTIN, which is 2 in most esp32 modules, including wroom. Wroom has two LEDs on board. The red led is power. The blue led is 2. You should see blue led lights up.

I know that the ESP32 has red and blue LEDs. What I want to do is to light up an LED that I have newly connected. I believe that LED_BUILTIN refers to the blue LED built into the ESP32, is that correct?

Correct. LED_BUILTIN is 2 on esp32.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants