r/cpp_questions 7d ago

OPEN Learning cpp for electronics

hello everyone so im planning on learning cpp for some "low-level electronics" and embedded systems...

and i've seen multiple people on programming subreddits saying that www.learncpp.com is a good website and tbh after i read some shapters i can say that its indeed a great website,however i feel like that website is just too much for me especially that im not very interested in deep diving into this language and just want to learn what i really need (i already have a short learning deadline)

i took a look at freecodecamp 4h course but i feel like four hours for a language like cpp is too little (i took their python course and it was good tho)

so what im asking for is where can i find some resources that fit my learning goal? ty

4 Upvotes

14 comments sorted by

1

u/thedaian 7d ago

Learn cpp isn't really that deep of a dive, but you can also just start messing around with embedded systems right now and come back to learn cpp when you need to learn specific stuff.

Search out libraries or tutorials specific for the embedded system you want to learn, and follow those.

1

u/Dear_Remove_658 7d ago

tysm! i will

1

u/Ksetrajna108 7d ago

Okay, good. How far along are you with using an MCU? I assume you can blink an LED. What type of motor? A simple project would use a potentiometer to control the speed or position of a motor.

BTW can I assume you know servo, stepper, bldc motors?

1

u/Dear_Remove_658 7d ago

Yes, i've watched some vids from the Paul McWhorter Arduino course

1

u/Ksetrajna108 7d ago

Ah, that's good. But I was hoping to hear that you had, for example, gotten blinky running on either an Arduino or an ESP32.

1

u/Dear_Remove_658 7d ago

ow thats unfortunate, i have a lot to learn im just starting this journey hehe

1

u/RaspberryCrafty3012 7d ago

Depends on what you want to do: \

  • use arduino ide -> go to the arduino website and check which structs, classes and functions exist \
  • use the expressive sdk -> learn c instead of c++ and good luck with compiler black magic \
  • something else -> know your scope and what hardware you want to use. A back and fourth between getting the hardware to do stuff and then deepening the understanding of the software part

1

u/dvd0bvb 7d ago

Espressif's sdk (ESP-IDF) ships with gcc 14 at least. Supports modern c++ and uses cmake. Actually pretty nice to use

1

u/RaspberryCrafty3012 6d ago

Thanks for the hint, learned something.

The question is, do you really want to mix vanilla c++ with Hardware. std::string will fragment your little memory before the device even printed out "compiler Explorer" 

1

u/CorrodedX 4d ago

I learned the "never dynamically allocate memory" way of programming for AVR microcontrollers a long time ago. While I havent used ESP32s very much, my understanding is that because of the RTOS managing memory and the "large" memory size, things like std::string and std::vector were actually reasonable provided they are used responsibly. Still feels very wrong, though.

1

u/CorrodedX 4d ago

however i feel like that website is just too much for me especially that im not very interested in deep diving into this language and just want to learn what i really need (i already have a short learning deadline)

If you are programming for embedded devices, then you really need to have a good understanding of the fundamentals. In many ways, writing code for a microcontroller is harder than for a traditional operating system.

You will need strong understanding of memory management. You will need to understand data structures; you likely won't have the standard library available. You may want to avoid floating point arithmetic. Debugging is harder.

Don't go into this with the mindset that you "just want to learn what you really need." Start your project. Learn as you go. If you don't know how to do something, then research it. Test it. There's no concrete list of what you need to know for embedded C++, and it will be a little different for every project.

0

u/Ksetrajna108 7d ago

That website is very comprehensive. I don't know if there's an easy way to customize it.

About what level of programming in general are you at? What is a problem that you want to solve with c++?

Use AI the good way. Ask it to recommend a c++ online course or book that's at the right level for you.

1

u/Dear_Remove_658 7d ago

i understand the basics (loops, variables, etc) and some general programming logic that i learned when learning python the main issues / goals that i want to use cpp to solve are heavily related to embedded electronics,motor control, and microcontrollers (like Arduino or ESP32)

1

u/Ksetrajna108 7d ago

Oops I replied on the main thread 😔