GaussSense Desktop brings your Mini GaussSense into the huge community of web development. You could now build rich interactive prototype and applications with HTML / CSS / Javascript and any web frameworks or plugins of your choice!
ππΌ Before starting, please connect an Arduino Board with Mini GaussSense and upload the Arduino firmware to the board ππΌ Head First Mini GaussSense.
Please set up your GaussSense Desktop and Mini GaussSense following First Steps with GaussSense Desktop
After connecting Mini GaussSense, GaussSense Desktop would start a WebSocket server (port: 5100
) to send the sensor data.
Simply include GaussSense.js in <body></body> to receive data from Mini GaussSense.
<script src="http://gausstoys.com/libs/gausssense.js"></script>
Then use the GaussSense
object in your Javascript.
var gs = new GaussSense();
After that, let's start a new project or explore a lot of web projects on π GaussSense Playground
Live Demo on JS Bin: Example using GaussSense.js and p5.js
p5.js is a Javascript port of the Processing language. We could include the script in <body></body> as well to start a p5.js project.
<script src="//cdnjs.cloudflare.com/ajax/libs/p5.js/0.3.3/p5.min.js"></script>
A p5.js project contains two main functions: setup()
and draw()
. The setup()
block runs once, and is typically used for initialization. The draw()
block runs repeatedly to refresh the canvas element, and is used for animation.
We could access the north/south point and the bipolar midpoint of Mini GaussSense with a GaussSense object.
Get Methods | Meaning |
---|---|
getNorthPoint() | Get the north point object. Attributes: x , y , intensity |
getSouthPoint() | Get the south point object. Attributes: x , y , intensity |
getBipolarMidpoint() | Get the bipolar midpoint object. Attributes: x, y, intensity, angle, pitch |
x and y lies within the interval [0, 1] and would be -1 when the intensity of magnetic field is 0.
Back to Tutorials