Difference between revisions of "Dashboard"

From Microduino Wiki
Jump to: navigation, search
(Created page with "{| style="width: 800px;" |- | ==Objective== The course will show you how to achieve a dashboard through Processing to display the inductive magnetic field change of Microduin...")
 
 
Line 27: Line 27:
 
==Debugging==
 
==Debugging==
  
Step 1:Build the hardware environment according to the schematic, just like:   
+
Step 1: Build the hardware environment according to the schematic, just like:   
 
[[File:processingDashboardConnectionDiagram.jpg|600px|center|thumb]]
 
[[File:processingDashboardConnectionDiagram.jpg|600px|center|thumb]]
  
Line 33: Line 33:
 
https://github.com/manifestinteractive/arduino/tree/master/Libraries/HMC5883L
 
https://github.com/manifestinteractive/arduino/tree/master/Libraries/HMC5883L
  
Step 2: Here is the code:
+
Step 2: Here is the code:
  
 
The code of the two ends(Processing and Microduino)
 
The code of the two ends(Processing and Microduino)
Line 39: Line 39:
 
Microduino:
 
Microduino:
  
Initialize HMC5883L in “setup()  
+
Initialize HMC5883L in "setup()"  
  
 
Calculate the angle of the magnetic induction  
 
Calculate the angle of the magnetic induction  
Line 69: Line 69:
 
   }
 
   }
  
Function Reference:
+
Function Reference:
  
 
//Draw the center point of the dashboard  
 
//Draw the center point of the dashboard  
Line 84: Line 84:
  
  
Step 3:Download the code and get it compiled successfully.  
+
Step 3: Download the code and get it compiled successfully.  
  
Step 4:Use a magnet to change the magnetic field to see if the pointer changes after the system goes well.  
+
Step 4: Use a magnet to change the magnetic field to see if the pointer changes after the system goes well.  
  
 
==Result==
 
==Result==

Latest revision as of 09:34, 13 September 2016

Objective

The course will show you how to achieve a dashboard through Processing to display the inductive magnetic field change of Microduino.

Equipment

  • Other Hardware Equipment
    • A USB cable

Schematic

Just use the HMC5883L magnetic field strength sensor of Microduino-10DOF.


Program

https://github.com/Microduino/Microduino_Tutorials/tree/master/Microduino_Processing/MicroduinoDashboard

https://github.com/Microduino/Microduino_Tutorials/tree/master/Microduino_Processing/ProcessingDashboard

Debugging

Step 1: Build the hardware environment according to the schematic, just like:

ProcessingDashboardConnectionDiagram.jpg

Download the library function of HMC5883L: https://github.com/manifestinteractive/arduino/tree/master/Libraries/HMC5883L

Step 2: Here is the code:

The code of the two ends(Processing and Microduino)

Microduino:

Initialize HMC5883L in "setup()"

Calculate the angle of the magnetic induction

//Output() used to output the calculated angle to the serial port

 // Output the data down the serial port.
 void Output(int RoundDegreeInt)
 {
   //Serial.println();
   Serial.println(RoundDegreeInt);
   delay(150);
 }


Processing:

//Get the data of the first serial port.

 myPort = new Serial(this, Serial.list()[0], 9600);

//The code below in drawCube() is used to acquire the serial data

 while (myPort.available() > 0) {
   myString = myPort.readStringUntil(lf);
   if (myString != null) {
 //print(myString);  // Prints String
   angle=float(myString);  // Converts and prints float
   println(angle);
   }
 }

Function Reference:

//Draw the center point of the dashboard buildpoint()

//Draw the dashboard and the pointer scale builddashboard()

//Receive the serial data and draw the center point drawCube()

//Draw the whole dashboard drawCube1()


Step 3: Download the code and get it compiled successfully.

Step 4: Use a magnet to change the magnetic field to see if the pointer changes after the system goes well.

Result

A little compass will be displayed on the scree, which goes along with the change of the magnetic field, just like:

ProcessingDashboardResult.jpg


Video