SENSOR RESEARCH
Sensor/C++
Concept
When I worked at Bluecadet, I learned a new programming language framework (Cinder C++). In this project, I researched potential sensors and then tested them to ensure they were viable for future Bluecadet projects.
Problem
While researching these potential sensors, there were two key elements needed to ensure functionality. 1) The sensor is compatible with Cinder, a C++ library for programming. 2) The sensor supports a USB connection. From my research, I found that the Yocto–3D–V2 sensor fulfilled both requirements. This sensor includes a 3-axis accelerometer, gyroscope, compass, and provides its functional library. The challenge was trying to make the Yocto-3D-V2 library integrate with Cinder.
Solution
The Yocto library provides sample codes for polling data from each function but this ease hides an efficiency issue. To use data effectively, I need to access the value change callback function. In other words, I would define a MyValueCallback function and I asked the API to automatically call it each time the sensor value changes significantly. Because there is no C++ sample code for the value change callback function, I followed the C# sample code in Unity to be familiar with the value change callback function. My mentors and I came up with the syntax of C++ to call out the data we needed from the sensor.
The 2D inclinometer
Acceleration
Yoctopuce library: Roll a ball example
© YangShanChou 2022