I am learning C++ with the goal of running applications that communicate with my Arduino projects via the serial port.
I have seen a few code examples that show how to use a serial port, but they all seem to use different libraries, and none explain the code. I'd like a book, or a tutorial that goes in depth covering that topic.
I'm using Windows 10 environment. If you don't know of a book, perhaps library suggestions will get me headed in the right direction.
My first project will be to transmit a little bit of data out the serial port to my Arduino. No response is required. Latter I will want two way communications, but for now transmit is all I need.
I do not need any "Window" of any kind on the computer, just dump some data.
It is an IDE for many different programming languages. It is the one that my current book "C++ All in One for Dummies" recommends, so that is what I am using. I have no idea why it does not include examples... perhaps the number of topics is too broad?
CodeBlocks does have example to create a simple windows form when you create a new project.
Keep in mind that, C++ itself is cross-platform, but interacting with Windows' resources requires Windows API. I don't know any book but there are abundance resources on the web (mostly from Microsoft itself) that have example code to request use of system resources.
Arduino_new, thanks. It's pretty confusing to me at this point, understanding which direction to start in. I understand that I need to interact with the Windows API.
Maybe I am trying to jump too far. Maybe I just need to continue learning C++ through my current book, but I just learned how to get the time in Unix format, which is just what I want to send to my Arduino project.
It probably is pretty simple, but finding an example that does what I want is getting me nothing but confused so far.
I am spending about eight hours a day studying C++ (while work is slow), so I am working hard to achieve my goal. I just need pointers.
It took MR FormerAWOL quite a few posts to make his point that I was perhaps on the wrong forum. So, I guess I will go ask elsewhere.
I've never done it, but my impression is that writing C++ on Windows and interacting with the API is something of a slog. I think that's why people use Python for that (never used it either).
Why C++? For code running on a computer to communicate with an Arduino, I would choose python - easier to write, and very well suited to this sort of task....
Though it sounds like this is partly an exercise in learning C++
DrAzzy:
Why C++? For code running on a computer to communicate with an Arduino, I would choose python - easier to write, and very well suited to this sort of task....
Though it sounds like this is partly an exercise in learning C++
I started trying to learn Python, but when I was not learning how to do what I wanted to do, ie talk to hardware I got into Arduino instead. I have a lot of time invested in C++, especially since I do so much Arduino programming. It might be a good idea to go back to Visual C++ (I studied that for a while too), once I have a better grounding in C++.
Python would probably be easier, I'm sure. Just that I think C++ is my better long term language.
There is here: Jan Axelson's Lakeview Research
Her book is one of THE references for USB, but the serial book was last published in 2007, and I’m not sure how much windows apis have changed since then.
In the most basic form, you open “COMn:” and read/write it like any other file. But you may need additional setup to ensure asynchronous behavior.