Hey everyone! I'm diving into robotics and small projects, but I'm pretty new to programming. I took a C++ course a couple of months ago as part of my degree, and although I've grasped the basics like loops and variables, I feel stuck. We briefly touched on functions before we shifted to group projects, and now I'm left wondering how to actually build things with C++. I know these basics are the foundation for robotics and projects, but I won't have the chance to learn more advanced topics at university. Can anyone suggest resources, tutorials, or tips to help me get started on my own projects? Any guidance would be super appreciated!
6 Answers
If you're looking to get into robotics, I'd recommend checking out ROS2 (Robot Operating System 2). It's basically the industry standard for anything related to robotics and can provide a structured way to work on your projects and integrate various components, helping you advance your skills!
Consider this: if you have a device connected to your computer, say, an 8-bit LED driver at address A, you can control the LEDs by sending binary data to that address. If you set a bit to 1 at address A, the corresponding LED lights up! Understanding binary and hexadecimal is useful here. This basics will help you understand how to communicate with hardware and perform actions like moving robotic arms based on commands you write in code. It's really about specifying data to the correct address to control objects.
You might also want to try programming simple 2D games! If you're familiar with getting user input and printing text, graphic game programming isn't too far off. Libraries exist that help check keyboard and mouse states to display graphics. A solid resource is the SDL library, which you can learn from. Just focus on the basics at first; this can improve your programming skills while having fun with game dev! Also, when you're ready to dive deeper into specific domains, remember to search for relevant libraries for whichever language you’re using, like 'C++ game library' and explore!
A great way to start is by grabbing an Arduino starter kit! With these kits, you can start experimenting right away. Microcontrollers like Arduinos have I/O pins that you use to control physical hardware—pretty exciting! You can program them using C++, and they provide hands-on experience with robotics. If you want something more advanced, there are also Raspberry Pi boards that allow you to use various programming languages since they're full-blown computers running Linux. A simple robot kit from a place like Sunfounder could also be really fun to tinker with!
It’s easier than it seems! You're just going to have to model the movements of a robot using data and functions. Think of it like this: you use variables to represent the robot's location in space. Then you create functions to move it—like a move() function—to incrementally change its position until it reaches a target. Programming is all about translating these concepts into code. Start with a small project goal and just tackle it step by step—make it your own and enjoy the process! It will all start to click together!
Oh, and definitely check out the ‘awesome-cpp’ repo on GitHub. It’s an extensive list of C++ libraries, frameworks, and tools that can help you after the introductory phase. There are sample projects linked, which is really useful. Pick an area you're interested in, explore a library, and clone the examples to start tweaking them—it’s a fantastic way to leap into more complex coding while still being manageable!

I still have loads of sensors from my kit too, and I built some cool stuff with them ages ago!