I'm working on a project in which I'm using a Walabot (a radar sensor) in c++. With this sensor I can detect if I wave my hand in front of the sensor. I'm also doing other stuff ofcourse with the sensor but that doesn't matter for this, but I need a webpage where I can show different things and I want to be able to 'swipe' in between them. I can detect the swipes in my c++ code but how do I translate this to HTML or javascript? The swipe can be made into a boolean or just a simple integer with the number showing which page I want to show.
In short: I want to pass an integer or boolean from c++ code to HTML/javascript and if that value changes it has to reflect aswell in the html, it can't be a static thing that only gets initialised in the beginning.
I saw something about nodejs but can't really see how that is supposed to make the value obtainable by the HTML. REST seems like a possibility too.
In your c++ program, that's responsible for reading the radar output, you probably have a loop that constantly reads values from the radar. Add a timer and choose a time interval. In the loop, if the timer has reached the time interval, make it update a file with a label, telling you what event occurred most recently, e.g. a swipe, or if no even occurred.
In you JavaScript, make a loop that reads that file with the same time interval as it's updated by the radar program. Then, if the label in the file corresponds to an event, make the JavaScript take the appropriate action.
You could update the content of your page with functions like document.getElementById(), removeChild(), document.createElement(), and appendChild().