Getting data from sensors/switches without a library?

Hi everyone! I'm Krish, brand new to the forums. So...I have a little experience with using switches and what not, but in all the cases I have done so I had a library that was provided by a professor to use. Now I am trying to do an independent project which will require me to use buttons and sensors but I have no clue how to code using them (in C++ at least, I'm told labview would make it easy) without a given library. Can anyone offer some help on this? Thanks!
It depends entirely on the switches you are using. Look up the manufacturer and find their documentation.
So there is no general code I can use to operate any arbitrary switch? The switches I have are already installed on the board. What if I just find old switches and solder them to a board, there's no way to use them?
C++ doesn't know anything about any devices on the computer. For all it knows there may not even be a keyboard or monitor. You need to look up your device documentation to see how to communicate with it - it is not possible with pure C++, so you will need to ask the operating system for help.

If you are compiling your program as a freestanding program instead of a hosted program (no operating system) you pwobably will be either using a library provided with your device, or you will be manually reading and writing preset memory addresses (better hope not).
Last edited on
Topic archived. No new replies allowed.