Sensor data transmitted as OSC over Wifi – Huzzah ESP8266

This post describes the assembly of a wireless sensor transmitter suitable for music and art performance and installation setups. It has been very reliable for performance. At the time of writing I had to learn that the sensor used here (LSM9DS0 with i2c) is not produced anymore. I will update this post in the near future with a more up-to-date sensor breakout board.

void getMag() { // To read from the magnetometer, you must first call the // readMag() function. When this exits, it’ll update the // mx, my, and mz variables with the most current data. dof.readMag();

// Now we can use the mx, my, and mz variables as we please. // Either print them as raw ADC values, or calculated in Gauss. mX = dof.calcMag(dof.mx); mY = dof.calcMag(dof.my); mZ = dof.calcMag(dof.mz); }

void getGyro() { // To read from the gyroscope, you must first call the // readGyro() function. When this exits, it’ll update the // gx, gy, and gz variables with the most current data. dof.readGyro(); gX = dof.calcGyro(dof.gx); gY = dof.calcGyro(dof.gy); gZ = dof.calcGyro(dof.gz);

}

void getAccel() { // To read from the accelerometer, you must first call the // readAccel() function. When this exits, it’ll update the // ax, ay, and az variables with the most current data. dof.readAccel();

// If you want to print calculated values, you can use the // calcAccel helper function to convert a raw ADC value to // g’s. Give the function the value that you want to convert. aX = dof.calcAccel(dof.ax); aY = dof.calcAccel(dof.ay); aZ = dof.calcAccel(dof.az);