With GaussSense SDK for Processing, you can easily visualize the magnetic field on Mini GaussSense as well as the bipolar points (north and south), roll angle, and pitch angle of tilt.
In this tutorial, you will learn how to use the examples of GaussSense SDK to showcase the basic features of Mini GaussSense.
Open File > Examples… > Contributed Libraries > GaussSense SDK for Processing. You can see 9 examples in the Basics folder.
We are going through the first 5 examples here.
e1_HelloGaussSense example, you can see a function called
This function draws the magnetic field sensed by Mini GaussSense in 2D.
Simply change the value of
this.height to create images of the size you want.
In the second example
e2_UpsampledData2d , you can use the
drawUpsampledData2D function to draw a smoother magnetic field.
int upsampleFactor = 5; // Set between 1 ~ 10 gs.drawUpsampledData2D(this.width, this.height, upsampleFactor);
Before moving on, let's first take a look at the GData data type.
GData stores useful information about a polar point such as its position in the Processing window, intensity, pitch and roll angles, etc.
|Get Methods||Return Type||Meaning|
|float||Get the X coordinate on the display.|
|float||Get the Y coordinate on the display.|
|int||Get the magnetic field intensity. Unit: Gauss|
|float||Get the angle of roll. Unit: Radian|
|float||Get the pitch of tilt.|
|int||Get the polarity of magnetic field. (0: North, 1: South)|
Draw different kinds of polar points with
Also, simply get their information (without drawing) with
float thld = 15; // Unit: Gauss float PointRadius = 15; // Draw both polar points with intensity threshold gs.drawBasicBipolarPoints(thld, PointRadius); // Draw N/S polar point with intensity threshold gs.drawBasicNorthPoint(thld, PointRadius); gs.drawBasicSouthPoint(thld, PointRadius); // Get information (position, intensity) of N/S polar point GData pNorth = gs.getNorthPoint(thld); GData pSouth = gs.getSouthPoint(thld);
e4_TiltableBipolarPoints , we could visualize the tilt of each polar point.
drawTiltableSouthPoint functions to draw the tilting angle and intensity.
float lowThld = 15; float highThld = 30; // Select high and low thresholds to draw the tilt of N/S polar point gs.drawTiltableNorthPoint(lowThld, highThld); gs.drawTiltableSouthPoint(lowThld, highThld); // Get information (position, intensity, angle, pitch) of N/S polar point GData pTiltableNorth = gs.getTiltableNorthPoint(lowThld, highThld); GData pTiltableSouth = gs.getTiltableSouthPoint(lowThld, highThld);
When you put a magnet in a vertical position on the Mini GaussSense, both polar points can be detected by the Mini GaussSense.
In our 5th example
e5_RollAndTiltBipolarMidPoint , you can use
drawBasicBipolarMidpoint function to draw the midpoint between both polar points, including its rotation and tilt.
float thld = 15; float RectSize = 60; // Draw midpoint with intensity threshold and size specified gs.drawBasicBipolarMidpoint(thld, RectSize); // Get information (position, intensity, angle, pitch) of midpoint GData pBipolarMidpoint = gs.getBipolarMidpoint(thld);
Great! Let's explore the 2x2 Mini GaussSense now.
Or, start learning How to Use NFC Reader for GaussSense.
Get more advanced features of GaussSense SDK for Processing here: GaussSense SDK for Processing Documentation