This week I decided to treat the Yun as a websocket server so that I could control a motor remotely. The environment I setup was structure like this:
A remote node server running socket.io handles the incoming data from the phone’s gyro sensor. The node server then rounds the values down to the closest integer (ie. 45.929329329 is converted to 45) and transmits the data to a node ws server running on the Arduino Yun’s linux environment as a string – this seems to be a limitation of node WS. As the values are transferred from the Yun’s linux environment to the arduino’s processor, they are converted to integers and then used to control the servo’s angle.
Github repo here: https://github.com/davidptracy/phoneGyroToMotor