{"id":727,"date":"2020-04-06T03:12:15","date_gmt":"2020-04-05T20:12:15","guid":{"rendered":"https:\/\/www.phidgets.com\/educationDEV\/?page_id=727"},"modified":"2021-08-14T03:04:13","modified_gmt":"2021-08-13T20:04:13","slug":"spatial-sensor","status":"publish","type":"page","link":"https:\/\/www.phidgets.com\/education\/learn\/device-tutorials\/spatial-sensor\/","title":{"rendered":"Spatial sensor (archived)"},"content":{"rendered":"<p>[et_pb_section bb_built=&#8221;1&#8243; inner_width=&#8221;auto&#8221; inner_max_width=&#8221;1200px&#8221; next_background_color=&#8221;#000000&#8243;][et_pb_row][et_pb_column type=&#8221;1_2&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221;][et_pb_code admin_label=&#8221;Spatial sensor&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;]<\/p>\n<div class=\"ph-has-adjacent-panel\"><!-- [et_pb_line_break_holder] -->  <\/p>\n<div class=\"ph-overline-text\"><a href=\"\/education\/learn\/device-tutorials\">Device tutorials<\/a><\/div>\n<p><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->  <\/p>\n<h1>Spatial Phidget<\/h1>\n<p><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->  <pee>The Spatial Phidget contains a 3-axis accelerometer, 3-axis gyroscope and a 3-axis magnetometer.<\/pee><!-- [et_pb_line_break_holder] --><pee>The <strong>accelerometer<\/strong> measures acceleration in units of g-force. A stationary object experiences 1 g of acceleration due to the Earth&#8217;s gravitational field. A high-speed roller coaster typically develops 4 g to 6 g.<\/pee><!-- [et_pb_line_break_holder] --><pee>The <strong>gyroscope<\/strong> measures rotational motion. Rotational motion (also known as angular velocity) is measured in degrees per second (\u00b0\/s). The gyroscope will provide angular velocity between -2000 and 2000\u00b0\/s in the x, y and z-axis. This allows you to track the orientation of an object in 3D space. <\/pee><!-- [et_pb_line_break_holder] --><pee>The <strong>magnetometer<\/strong> measures magnetic fields. The magnetometer will report magnetic field strength along the x, y, and z axes. Magnetic field strength is measured in units of Gauss (G). <\/pee><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><a class=\"ph-button-link\" href=\"\/education\/learn\/device-tutorials\/spatial-sensor\/#tutorial\"><!-- [et_pb_line_break_holder] -->  <\/p>\n<div class=\"ph-button-link__icon\"><\/div>\n<p><!-- [et_pb_line_break_holder] -->  See tutorial<!-- [et_pb_line_break_holder] --><\/a><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><\/div>\n<p>[\/et_pb_code][\/et_pb_column][et_pb_column type=&#8221;1_2&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221;][et_pb_image _builder_version=&#8221;4.4.1&#8243; src=&#8221;https:\/\/www.phidgets.com\/education\/wp-content\/uploads\/2020\/04\/deivce-spatial.jpg&#8221; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; \/][\/et_pb_column][\/et_pb_row][\/et_pb_section][et_pb_section bb_built=&#8221;1&#8243; specialty=&#8221;on&#8221; prev_background_color=&#8221;#000000&#8243; _builder_version=&#8221;4.4.1&#8243; use_custom_gutter=&#8221;on&#8221; gutter_width=&#8221;3&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; module_id=&#8221;tutorial&#8221;][et_pb_column type=&#8221;1_4&#8243;][et_pb_code admin_label=&#8221;ph-vertical-nav&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; saved_tabs=&#8221;all&#8221;]<\/p>\n<div class=\"ph-vertical-nav ph-vertical-sticky\"><!-- [et_pb_line_break_holder] -->  <a href=\"\/education\/learn\/device-tutorials\/spatial-sensor\/#setup\" class=\"ph-vertical-nav-item active\">Setup<\/a><!-- [et_pb_line_break_holder] -->  <a href=\"\/education\/learn\/device-tutorials\/spatial-sensor\/#write-code-accel\" class=\"ph-vertical-nav-item\">Accelerometer Code<\/a><!-- [et_pb_line_break_holder] -->  <a href=\"\/education\/learn\/device-tutorials\/spatial-sensor\/#applications-accel\" class=\"ph-vertical-nav-item\">Accelerometer Applications<\/a><!-- [et_pb_line_break_holder] -->  <a href=\"\/education\/learn\/device-tutorials\/spatial-sensor\/#practice-accel\" class=\"ph-vertical-nav-item\">Accelerometer Practice<\/a><!-- [et_pb_line_break_holder] -->  <a href=\"\/education\/learn\/device-tutorials\/spatial-sensor\/#write-code-gyro\" class=\"ph-vertical-nav-item\">Gyroscope Code<\/a><!-- [et_pb_line_break_holder] -->  <a href=\"\/education\/learn\/device-tutorials\/spatial-sensor\/#applications-gyro\" class=\"ph-vertical-nav-item\">Gyroscope Applications<\/a><!-- [et_pb_line_break_holder] -->  <a href=\"\/education\/learn\/device-tutorials\/spatial-sensor\/#practice-gyro\" class=\"ph-vertical-nav-item\">Gyroscope Practice<\/a><!-- [et_pb_line_break_holder] -->  <a href=\"\/education\/learn\/device-tutorials\/spatial-sensor\/#write-code-mag\" class=\"ph-vertical-nav-item\">Magnetometer Code<\/a><!-- [et_pb_line_break_holder] -->  <a href=\"\/education\/learn\/device-tutorials\/spatial-sensor\/#applications-mag\" class=\"ph-vertical-nav-item\">Magnetometer Applications<\/a><!-- [et_pb_line_break_holder] -->  <a href=\"\/education\/learn\/device-tutorials\/spatial-sensor\/#practice-mag\" class=\"ph-vertical-nav-item\">Magnetometer Practice<\/a><!-- [et_pb_line_break_holder] -->  <a href=\"\/education\/learn\/device-tutorials\/spatial-sensor\/#troubleshoot\" class=\"ph-vertical-nav-item\">Troubleshoot<\/a><!-- [et_pb_line_break_holder] --><\/div>\n<p>[\/et_pb_code][\/et_pb_column][et_pb_column type=&#8221;3_4&#8243; specialty_columns=&#8221;3&#8243;][et_pb_row_inner _builder_version=&#8221;4.4.1&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; module_id=&#8221;setup&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;][et_pb_column_inner type=&#8221;4_4&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_code admin_label=&#8221;Setup&#8221; _builder_version=&#8221;4.4.3&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;]<\/p>\n<h3>Setup<\/h3>\n<p><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Before you do any coding you will have to attach your Spatial Phidget to your VINT Hub as shown:<\/pee>[\/et_pb_code][et_pb_image _builder_version=&#8221;4.4.1&#8243; src=&#8221;https:\/\/www.phidgets.com\/education\/wp-content\/uploads\/2020\/04\/setup-spatial-scaled.jpg&#8221; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; \/][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; module_id=&#8221;write-code-accel&#8221; module_class=&#8221;ph-hidden-anchor&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;][et_pb_column_inner type=&#8221;4_4&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_code admin_label=&#8221;Write Code &#8211; row hidden anchor &#8211; accel&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; \/][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner _builder_version=&#8221;4.4.5&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; module_class=&#8221;ph-user-java&#8221;][et_pb_column_inner type=&#8221;4_4&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_code admin_label=&#8221;Code (Java) &#8211; Accel&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;]<\/p>\n<h3>Code (Java) &#8211; Accelerometer<\/h3>\n<p><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Create a file called <em>Spatial<\/em> and insert the following code. Run your code. Move your Spatial Phidget to see the output change.<\/pee><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Not your programming language? <a class=\"ph-toggle-settings\">Set my language and IDE<\/a>.<\/pee>[\/et_pb_code][et_pb_code admin_label=&#8221;Code Sample &#8211; Netbeans&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; module_class=&#8221;ph-user-netbeans&#8221;]<!-- Device tutorials: spatial --><!-- [et_pb_line_break_holder] --><\/p>\n<pre class=\"language-java\"><!-- [et_pb_line_break_holder] -->  <code><!-- [et_pb_line_break_holder] -->package spatial;<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->\/\/Add Phidgets Library<!-- [et_pb_line_break_holder] -->import com.phidget22.*;<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->public class Spatial{<!-- [et_pb_line_break_holder] -->    public static void main(String[] args) throws Exception {<!-- [et_pb_line_break_holder] -->        <!-- [et_pb_line_break_holder] -->        \/\/Create<!-- [et_pb_line_break_holder] -->        Accelerometer accelerometer = new Accelerometer();<!-- [et_pb_line_break_holder] -->        <!-- [et_pb_line_break_holder] -->        \/\/Open<!-- [et_pb_line_break_holder] -->        accelerometer.open(1000);<!-- [et_pb_line_break_holder] -->        <!-- [et_pb_line_break_holder] -->        \/\/Use your Phidgets<!-- [et_pb_line_break_holder] -->        while (true) {<!-- [et_pb_line_break_holder] -->            System.out.println(\"Acceleration: x = \" + accelerometer.getAcceleration()[0] + \" g | y = \" + accelerometer.getAcceleration()[1] + \" g | z = \" + accelerometer.getAcceleration()[2]+ \" g\");<!-- [et_pb_line_break_holder] -->            Thread.sleep(250);<!-- [et_pb_line_break_holder] -->        }<!-- [et_pb_line_break_holder] -->    }<!-- [et_pb_line_break_holder] -->}<!-- [et_pb_line_break_holder] -->  <\/code><!-- [et_pb_line_break_holder] --><\/pre>\n<p>[\/et_pb_code][et_pb_code admin_label=&#8221;Code Sample &#8211; Eclipse&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; module_class=&#8221;ph-user-eclipse&#8221;]<!-- Device tutorials: spatial --><!-- [et_pb_line_break_holder] --><\/p>\n<pre class=\"language-java\"><!-- [et_pb_line_break_holder] -->  <code><!-- [et_pb_line_break_holder] -->\/\/Add Phidgets Library<!-- [et_pb_line_break_holder] -->import com.phidget22.*;<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->public class Spatial{<!-- [et_pb_line_break_holder] -->    public static void main(String[] args) throws Exception {<!-- [et_pb_line_break_holder] -->        <!-- [et_pb_line_break_holder] -->        \/\/Create<!-- [et_pb_line_break_holder] -->        Accelerometer accelerometer = new Accelerometer();<!-- [et_pb_line_break_holder] -->        <!-- [et_pb_line_break_holder] -->        \/\/Open<!-- [et_pb_line_break_holder] -->        accelerometer.open(1000);<!-- [et_pb_line_break_holder] -->        <!-- [et_pb_line_break_holder] -->        \/\/Use your Phidgets<!-- [et_pb_line_break_holder] -->        while (true) {<!-- [et_pb_line_break_holder] -->            System.out.println(\"Acceleration: x = \" + accelerometer.getAcceleration()[0] + \" g | y = \" + accelerometer.getAcceleration()[1] + \" g | z = \" + accelerometer.getAcceleration()[2]+ \" g\");<!-- [et_pb_line_break_holder] -->            Thread.sleep(250);<!-- [et_pb_line_break_holder] -->        }<!-- [et_pb_line_break_holder] -->    }<!-- [et_pb_line_break_holder] -->}<!-- [et_pb_line_break_holder] -->  <\/code><!-- [et_pb_line_break_holder] --><\/pre>\n<p>[\/et_pb_code][et_pb_code admin_label=&#8221;Code Sample &#8211; Processing&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; module_class=&#8221;ph-user-processing&#8221;]<!-- Device tutorials: spatial --><!-- [et_pb_line_break_holder] --><\/p>\n<pre class=\"language-java\"><!-- [et_pb_line_break_holder] -->  <code><!-- [et_pb_line_break_holder] -->\/\/Add Phidgets Library<!-- [et_pb_line_break_holder] -->import com.phidget22.*;<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->\/\/Define<!-- [et_pb_line_break_holder] -->Accelerometer accelerometer;<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->void setup(){<!-- [et_pb_line_break_holder] -->  try{<!-- [et_pb_line_break_holder] -->    <!-- [et_pb_line_break_holder] -->    \/\/Create <!-- [et_pb_line_break_holder] -->     accelerometer = new Accelerometer();<!-- [et_pb_line_break_holder] -->    <!-- [et_pb_line_break_holder] -->    \/\/Open<!-- [et_pb_line_break_holder] -->    accelerometer.open(1000);<!-- [et_pb_line_break_holder] -->    <!-- [et_pb_line_break_holder] -->  }catch(Exception e){<!-- [et_pb_line_break_holder] -->    e.printStackTrace();<!-- [et_pb_line_break_holder] -->  }<!-- [et_pb_line_break_holder] -->}<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->void draw(){<!-- [et_pb_line_break_holder] -->  try{<!-- [et_pb_line_break_holder] -->    <!-- [et_pb_line_break_holder] -->    \/\/Use your Phidgets<!-- [et_pb_line_break_holder] -->    println(\"Acceleration: x = \" + accelerometer.getAcceleration()[0] + \" g | y = \" + accelerometer.getAcceleration()[1] + \" g | z = \" + accelerometer.getAcceleration()[2]+ \" g\");<!-- [et_pb_line_break_holder] -->    delay(250);<!-- [et_pb_line_break_holder] -->    <!-- [et_pb_line_break_holder] -->  }catch(Exception e){<!-- [et_pb_line_break_holder] -->    e.printStackTrace();<!-- [et_pb_line_break_holder] -->  }<!-- [et_pb_line_break_holder] -->}<!-- [et_pb_line_break_holder] -->  <\/code><!-- [et_pb_line_break_holder] --><\/pre>\n<p>[\/et_pb_code][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner _builder_version=&#8221;4.4.5&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; module_class=&#8221;ph-user-python&#8221;][et_pb_column_inner type=&#8221;4_4&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_code admin_label=&#8221;Code (Python) &#8211; Accel&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;]<\/p>\n<h3>Code (Python) &#8211; Accelerometer<\/h3>\n<p><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Create a file called <em>Spatial<\/em> and insert the following code. Run your code. Move your Spatial Phidget to see the output change.<\/pee><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Not your programming language? <a class=\"ph-toggle-settings\">Set my language and IDE<\/a>.<\/pee>[\/et_pb_code][et_pb_code admin_label=&#8221;Code sample&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;]<!-- Device tutorials: spatial --><!-- [et_pb_line_break_holder] --><\/p>\n<pre class=\"language-python\"><!-- [et_pb_line_break_holder] -->  <code><!-- [et_pb_line_break_holder] -->#Add Phidgets Library<!-- [et_pb_line_break_holder] -->from Phidget22.Phidget import *<!-- [et_pb_line_break_holder] -->from Phidget22.Devices.Accelerometer import *<!-- [et_pb_line_break_holder] -->#Required for sleep statement<!-- [et_pb_line_break_holder] -->import time<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->#Create<!-- [et_pb_line_break_holder] -->accelerometer = Accelerometer()<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->#Open<!-- [et_pb_line_break_holder] -->accelerometer.openWaitForAttachment(1000)<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->#Use your Phidgets<!-- [et_pb_line_break_holder] -->while (True):<!-- [et_pb_line_break_holder] -->    print(\"Acceleration: x = \" + str(accelerometer.getAcceleration()[0]) + \" g | y = \" + str(accelerometer.getAcceleration()[1]) +\" g | z = \" + str(accelerometer.getAcceleration()[2]))<!-- [et_pb_line_break_holder] -->    time.sleep(0.25)<!-- [et_pb_line_break_holder] -->  <\/code><!-- [et_pb_line_break_holder] --><\/pre>\n<p>[\/et_pb_code][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner _builder_version=&#8221;4.4.5&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; module_class=&#8221;ph-user-csharp&#8221;][et_pb_column_inner type=&#8221;4_4&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_code admin_label=&#8221;Code (C#) &#8211; Accel&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;]<\/p>\n<h3>Code (C#) &#8211; Accelerometer<\/h3>\n<p><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Create a file called <em>Spatial<\/em> and insert the following code. Run your code. Move your Spatial Phidget to see the output change.<\/pee><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Not your programming language? <a class=\"ph-toggle-settings\">Set my language and IDE<\/a>.<\/pee>[\/et_pb_code][et_pb_code admin_label=&#8221;Code sample&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;]<!-- Device tutorials: spatial --><!-- [et_pb_line_break_holder] --><\/p>\n<pre class=\"language-csharp\"><!-- [et_pb_line_break_holder] -->  <code><!-- [et_pb_line_break_holder] -->\/\/Add Phidgets Library<!-- [et_pb_line_break_holder] -->using Phidget22;<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->namespace Spatial{<!-- [et_pb_line_break_holder] -->    class Program{<!-- [et_pb_line_break_holder] -->        static void Main(string[] args){<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->            \/\/Create<!-- [et_pb_line_break_holder] -->            Accelerometer accelerometer = new Accelerometer();<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->            \/\/Open<!-- [et_pb_line_break_holder] -->            accelerometer.Open(1000);<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->            \/\/Use your Phidgets<!-- [et_pb_line_break_holder] -->            while (true)<!-- [et_pb_line_break_holder] -->            {<!-- [et_pb_line_break_holder] -->                System.Console.WriteLine(\"Acceleration: x = \" + accelerometer.Acceleration[0] + \"g | y = \" + accelerometer.Acceleration[1] + \"g | z = \" + accelerometer.Acceleration[2] + \"g\");<!-- [et_pb_line_break_holder] -->                System.Threading.Thread.Sleep(250);<!-- [et_pb_line_break_holder] -->            }<!-- [et_pb_line_break_holder] -->        }<!-- [et_pb_line_break_holder] -->    }<!-- [et_pb_line_break_holder] -->}<!-- [et_pb_line_break_holder] -->  <\/code><!-- [et_pb_line_break_holder] --><\/pre>\n<p>[\/et_pb_code][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner _builder_version=&#8221;4.4.5&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; module_class=&#8221;ph-user-swift&#8221;][et_pb_column_inner type=&#8221;4_4&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_code admin_label=&#8221;Code (Swift) &#8211; Accel&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;]<\/p>\n<h3>Code (Swift) &#8211; Accelerometer<\/h3>\n<p><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Create a file called <em>Spatial<\/em> and insert the following code. Run your code. Move your Spatial Phidget to see the output change.<\/pee><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Not your programming language? <a class=\"ph-toggle-settings\">Set my language and IDE<\/a>.<\/pee><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>You will need to add three Labels.<\/pee>[\/et_pb_code][et_pb_image _builder_version=&#8221;4.4.1&#8243; src=&#8221;https:\/\/www.phidgets.com\/education\/wp-content\/uploads\/2020\/04\/spatial-1.png&#8221; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; disabled_on=&#8221;off|off|off&#8221; disabled=&#8221;off&#8221; \/][et_pb_code admin_label=&#8221;Code sample&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;]<!-- Device tutorials: spatial --><!-- [et_pb_line_break_holder] --><\/p>\n<pre class=\"language-swift\"><!-- [et_pb_line_break_holder] -->  <code><!-- [et_pb_line_break_holder] -->import Cocoa<!-- [et_pb_line_break_holder] -->\/\/Add Phidget Library<!-- [et_pb_line_break_holder] -->import Phidget22Swift<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->class ViewController: NSViewController {<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->    @IBOutlet weak var xLabel: NSTextField!<!-- [et_pb_line_break_holder] -->    @IBOutlet weak var yLabel: NSTextField!<!-- [et_pb_line_break_holder] -->    @IBOutlet weak var zLabel: NSTextField!<!-- [et_pb_line_break_holder] -->    <!-- [et_pb_line_break_holder] -->    \/\/Create<!-- [et_pb_line_break_holder] -->    let accelerometer = Accelerometer()<!-- [et_pb_line_break_holder] -->    <!-- [et_pb_line_break_holder] -->    override func viewDidLoad() {<!-- [et_pb_line_break_holder] -->        super.viewDidLoad()<!-- [et_pb_line_break_holder] -->        do{<!-- [et_pb_line_break_holder] -->            \/\/Subscribe to event<!-- [et_pb_line_break_holder] -->            let _ = accelerometer.accelerationChange.addHandler(onAccelerationChange)<!-- [et_pb_line_break_holder] -->            <!-- [et_pb_line_break_holder] -->            \/\/Open<!-- [et_pb_line_break_holder] -->            try accelerometer.open()<!-- [et_pb_line_break_holder] -->        }catch{<!-- [et_pb_line_break_holder] -->            print(error)<!-- [et_pb_line_break_holder] -->        }<!-- [et_pb_line_break_holder] -->    }<!-- [et_pb_line_break_holder] -->    <!-- [et_pb_line_break_holder] -->    func onAccelerationChange(sender:Accelerometer, data: (acceleration:[Double], timestamp: Double)){<!-- [et_pb_line_break_holder] -->        DispatchQueue.main.async {<!-- [et_pb_line_break_holder] -->\t    \/\/Use information from your Phidget to change label<!-- [et_pb_line_break_holder] -->            self.xLabel.stringValue = \"X-axis: \" + String(data.acceleration[0]) + \"g\"<!-- [et_pb_line_break_holder] -->            self.yLabel.stringValue = \"Y-axis: \" + String(data.acceleration[1]) + \"g\"<!-- [et_pb_line_break_holder] -->            self.zLabel.stringValue = \"Z-axis: \" + String(data.acceleration[2]) + \"g\"<!-- [et_pb_line_break_holder] -->        }<!-- [et_pb_line_break_holder] -->    }<!-- [et_pb_line_break_holder] -->}<!-- [et_pb_line_break_holder] -->  <\/code><!-- [et_pb_line_break_holder] --><\/pre>\n<p>[\/et_pb_code][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; module_id=&#8221;applications-accel&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;][et_pb_column_inner type=&#8221;4_4&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_code admin_label=&#8221;Applications &#8211; Accel&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;]<\/p>\n<h3>Accelerometer Applications<\/h3>\n<p><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Accelerometers measure vibrations in audio applications (noise monitoring), mechanical (car tires), and buildings (seismic activity monitoring). Accelerometers monitor speed and g-force (for example, on a roller coaster). Accelerometers are also used in fall detection systems or in your Phone to rotate the screen from portrait to landscape view.<\/pee>[\/et_pb_code][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner admin_label=&#8221;Row&#8221; _builder_version=&#8221;4.4.5&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;][et_pb_column_inner type=&#8221;1_3&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_image _builder_version=&#8221;4.4.1&#8243; src=&#8221;https:\/\/www.phidgets.com\/education\/wp-content\/uploads\/2020\/04\/spatial-2.jpg&#8221; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; \/][\/et_pb_column_inner][et_pb_column_inner type=&#8221;1_3&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_image _builder_version=&#8221;4.4.1&#8243; src=&#8221;https:\/\/www.phidgets.com\/education\/wp-content\/uploads\/2020\/04\/spatial-3.jpg&#8221; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; \/][\/et_pb_column_inner][et_pb_column_inner type=&#8221;1_3&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_image _builder_version=&#8221;4.4.1&#8243; src=&#8221;https:\/\/www.phidgets.com\/education\/wp-content\/uploads\/2020\/04\/spatial-4.jpg&#8221; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; \/][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; module_id=&#8221;practice-accel&#8221; module_class=&#8221;ph-hidden-anchor&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;][et_pb_column_inner type=&#8221;4_4&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_code admin_label=&#8221;Practice &#8211; row hidden anchor &#8211; accel&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; \/][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner _builder_version=&#8221;4.4.5&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;][et_pb_column_inner type=&#8221;4_4&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_code admin_label=&#8221;Practice &#8211; Accel&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;]<\/p>\n<h3>Accelerometer Practice<\/h3>\n<p><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Create the beginning fall detection system using your Spatial Phidget and Getting Started Kit. <\/pee><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><\/p>\n<ol><!-- [et_pb_line_break_holder] --><\/p>\n<li>When the Phidget is sitting flat on your desk, turn on the green LED.  <\/li>\n<p><!-- [et_pb_line_break_holder] --><\/p>\n<li>When the Spatial Phidget moves, turn on the Red LED. <\/li>\n<p><!-- [et_pb_line_break_holder] --><\/ol>\n<p><!-- [et_pb_line_break_holder] -->[\/et_pb_code][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; module_id=&#8221;write-code-gyro&#8221; module_class=&#8221;ph-hidden-anchor&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;][et_pb_column_inner type=&#8221;4_4&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_code admin_label=&#8221;Write Code &#8211; row hidden anchor &#8211; gyro&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; \/][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner _builder_version=&#8221;4.4.5&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; module_class=&#8221;ph-user-java&#8221;][et_pb_column_inner type=&#8221;4_4&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_code admin_label=&#8221;Code (Java) &#8211; Gyro&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;]<\/p>\n<h3>Code (Java) &#8211; Gyroscope<\/h3>\n<p><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Create a file called <em>Spatial<\/em> and insert the following code. Run your code. Move your Spatial Phidget to see the output change.<\/pee><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Not your programming language? <a class=\"ph-toggle-settings\">Set my language and IDE<\/a>.<\/pee>[\/et_pb_code][et_pb_code admin_label=&#8221;Code Sample &#8211; Netbeans&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; module_class=&#8221;ph-user-netbeans&#8221;]<!-- Device tutorials: spatial --><!-- [et_pb_line_break_holder] --><\/p>\n<pre class=\"language-java\"><!-- [et_pb_line_break_holder] -->  <code><!-- [et_pb_line_break_holder] -->package spatial;<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->\/\/Add Phidgets Library<!-- [et_pb_line_break_holder] -->import com.phidget22.*;<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->public class Spatial{<!-- [et_pb_line_break_holder] -->    public static void main(String[] args) throws Exception {<!-- [et_pb_line_break_holder] -->        <!-- [et_pb_line_break_holder] -->        \/\/Create<!-- [et_pb_line_break_holder] -->        Gyroscope gyroscope = new Gyroscope();<!-- [et_pb_line_break_holder] -->        <!-- [et_pb_line_break_holder] -->        \/\/Open<!-- [et_pb_line_break_holder] -->       gyroscope.open(1000);<!-- [et_pb_line_break_holder] -->        <!-- [et_pb_line_break_holder] -->        \/\/Use your Phidgets<!-- [et_pb_line_break_holder] -->        while (true) {<!-- [et_pb_line_break_holder] -->            System.out.println(\"Gyroscope: x = \" + gyroscope.getAngularRate()[0] + \" \u00b0\/s | y = \" + gyroscope.getAngularRate()[1] + \" \u00b0\/s | z = \" + gyroscope.getAngularRate()[2]+ \" \u00b0\/s\");<!-- [et_pb_line_break_holder] -->            Thread.sleep(250);<!-- [et_pb_line_break_holder] -->        }<!-- [et_pb_line_break_holder] -->    }<!-- [et_pb_line_break_holder] -->}<!-- [et_pb_line_break_holder] -->  <\/code><!-- [et_pb_line_break_holder] --><\/pre>\n<p>[\/et_pb_code][et_pb_code admin_label=&#8221;Code Sample &#8211; Eclipse&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; module_class=&#8221;ph-user-eclipse&#8221;]<!-- Device tutorials: spatial --><!-- [et_pb_line_break_holder] --><\/p>\n<pre class=\"language-java\"><!-- [et_pb_line_break_holder] -->  <code><!-- [et_pb_line_break_holder] -->\/\/Add Phidgets Library<!-- [et_pb_line_break_holder] -->import com.phidget22.*;<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->public class Spatial{<!-- [et_pb_line_break_holder] -->    public static void main(String[] args) throws Exception {<!-- [et_pb_line_break_holder] -->        <!-- [et_pb_line_break_holder] -->        \/\/Create<!-- [et_pb_line_break_holder] -->        Gyroscope gyroscope = new Gyroscope();<!-- [et_pb_line_break_holder] -->        <!-- [et_pb_line_break_holder] -->        \/\/Open<!-- [et_pb_line_break_holder] -->       gyroscope.open(1000);<!-- [et_pb_line_break_holder] -->        <!-- [et_pb_line_break_holder] -->        \/\/Use your Phidgets<!-- [et_pb_line_break_holder] -->        while (true) {<!-- [et_pb_line_break_holder] -->            System.out.println(\"Gyroscope: x = \" + gyroscope.getAngularRate()[0] + \" \u00b0\/s | y = \" + gyroscope.getAngularRate()[1] + \" \u00b0\/s | z = \" + gyroscope.getAngularRate()[2]+ \" \u00b0\/s\");<!-- [et_pb_line_break_holder] -->            Thread.sleep(250);<!-- [et_pb_line_break_holder] -->        }<!-- [et_pb_line_break_holder] -->    }<!-- [et_pb_line_break_holder] -->}<!-- [et_pb_line_break_holder] -->  <\/code><!-- [et_pb_line_break_holder] --><\/pre>\n<p>[\/et_pb_code][et_pb_code admin_label=&#8221;Code Sample &#8211; Processing&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; module_class=&#8221;ph-user-processing&#8221;]<!-- Device tutorials: spatial --><!-- [et_pb_line_break_holder] --><\/p>\n<pre class=\"language-java\"><!-- [et_pb_line_break_holder] -->  <code><!-- [et_pb_line_break_holder] -->\/\/Add Phidgets Library<!-- [et_pb_line_break_holder] -->import com.phidget22.*;<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->\/\/Define<!-- [et_pb_line_break_holder] -->Gyroscope gyroscope;<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->void setup(){<!-- [et_pb_line_break_holder] -->  try{<!-- [et_pb_line_break_holder] -->    <!-- [et_pb_line_break_holder] -->    \/\/Create <!-- [et_pb_line_break_holder] -->    gyroscope = new Gyroscope();<!-- [et_pb_line_break_holder] -->    <!-- [et_pb_line_break_holder] -->    \/\/Open<!-- [et_pb_line_break_holder] -->    gyroscope.open(1000);<!-- [et_pb_line_break_holder] -->    <!-- [et_pb_line_break_holder] -->  }catch(Exception e){<!-- [et_pb_line_break_holder] -->    e.printStackTrace();<!-- [et_pb_line_break_holder] -->  }<!-- [et_pb_line_break_holder] -->}<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->void draw(){<!-- [et_pb_line_break_holder] -->  try{<!-- [et_pb_line_break_holder] -->    <!-- [et_pb_line_break_holder] -->    \/\/Use your Phidgets<!-- [et_pb_line_break_holder] -->    println(\"Gyroscope: x = \" + gyroscope.getAngularRate()[0] + \" \u00b0\/s | y = \" + gyroscope.getAngularRate()[1] + \" \u00b0\/s | z = \" + gyroscope.getAngularRate()[2]+ \" \u00b0\/s\");<!-- [et_pb_line_break_holder] -->    delay(250);<!-- [et_pb_line_break_holder] -->    <!-- [et_pb_line_break_holder] -->  }catch(Exception e){<!-- [et_pb_line_break_holder] -->    e.printStackTrace();<!-- [et_pb_line_break_holder] -->  }<!-- [et_pb_line_break_holder] -->}<!-- [et_pb_line_break_holder] -->  <\/code><!-- [et_pb_line_break_holder] --><\/pre>\n<p>[\/et_pb_code][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner _builder_version=&#8221;4.4.5&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; module_class=&#8221;ph-user-python&#8221;][et_pb_column_inner type=&#8221;4_4&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_code admin_label=&#8221;Code (Python) &#8211; Gyro&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;]<\/p>\n<h3>Code (Python) &#8211; Gyroscope<\/h3>\n<p><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Create a file called <em>Spatial<\/em> and insert the following code. Run your code. Move your Spatial Phidget to see the output change.<\/pee><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Not your programming language? <a class=\"ph-toggle-settings\">Set my language and IDE<\/a>.<\/pee>[\/et_pb_code][et_pb_code admin_label=&#8221;Code sample&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;]<!-- Device tutorials: spatial --><!-- [et_pb_line_break_holder] --><\/p>\n<pre class=\"language-python\"><!-- [et_pb_line_break_holder] -->  <code><!-- [et_pb_line_break_holder] -->#Add Phidgets Library<!-- [et_pb_line_break_holder] -->from Phidget22.Phidget import *<!-- [et_pb_line_break_holder] -->from Phidget22.Devices.Gyroscope import *<!-- [et_pb_line_break_holder] -->#Required for sleep statement<!-- [et_pb_line_break_holder] -->import time<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->#Create<!-- [et_pb_line_break_holder] -->gyroscope = Gyroscope()<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->#Open<!-- [et_pb_line_break_holder] -->gyroscope.openWaitForAttachment(1000)<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->#Use your Phidgets<!-- [et_pb_line_break_holder] -->while (True):<!-- [et_pb_line_break_holder] -->    print(\"Gyroscope: x = \" + str(gyroscope.getAngularRate()[0]) + \"\u00b0\/s | y = \" + str(gyroscope.getAngularRate()[1]) + \"\u00b0\/s | z = \" + str(gyroscope.getAngularRate()[2]) + \"\u00b0\/s\")<!-- [et_pb_line_break_holder] -->    time.sleep(0.25)<!-- [et_pb_line_break_holder] -->  <\/code><!-- [et_pb_line_break_holder] --><\/pre>\n<p>[\/et_pb_code][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner _builder_version=&#8221;4.4.5&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; module_class=&#8221;ph-user-csharp&#8221;][et_pb_column_inner type=&#8221;4_4&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_code admin_label=&#8221;Code (C#) &#8211; Gyro&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;]<\/p>\n<h3>Code (C#) &#8211; Gyroscope<\/h3>\n<p><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Create a file called <em>Spatial<\/em> and insert the following code. Run your code. Move your Spatial Phidget to see the output change.<\/pee><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Not your programming language? <a class=\"ph-toggle-settings\">Set my language and IDE<\/a>.<\/pee>[\/et_pb_code][et_pb_code admin_label=&#8221;Code sample&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;]<!-- Device tutorials: spatial --><!-- [et_pb_line_break_holder] --><\/p>\n<pre class=\"language-csharp\"><!-- [et_pb_line_break_holder] -->  <code><!-- [et_pb_line_break_holder] -->\/\/Add Phidgets Library<!-- [et_pb_line_break_holder] -->using Phidget22;<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->namespace Spatial<!-- [et_pb_line_break_holder] -->{<!-- [et_pb_line_break_holder] -->    class Program<!-- [et_pb_line_break_holder] -->    {<!-- [et_pb_line_break_holder] -->        static void Main(string[] args)<!-- [et_pb_line_break_holder] -->        {<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->            \/\/Create<!-- [et_pb_line_break_holder] -->            Gyroscope gyroscope = new Gyroscope();<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->            \/\/Open<!-- [et_pb_line_break_holder] -->            gyroscope.Open(1000);<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->            \/\/Use your Phidgets<!-- [et_pb_line_break_holder] -->            while (true)<!-- [et_pb_line_break_holder] -->            {<!-- [et_pb_line_break_holder] -->                System.Console.WriteLine(\"Gyroscope: x = \" + gyroscope.AngularRate[0] + \"\u00b0\/s | y = \" + gyroscope.AngularRate[1] + \"\u00b0\/s | z = \" + gyroscope.AngularRate[2] + \" \u00b0\/s\");<!-- [et_pb_line_break_holder] -->                System.Threading.Thread.Sleep(250);<!-- [et_pb_line_break_holder] -->            }<!-- [et_pb_line_break_holder] -->        }<!-- [et_pb_line_break_holder] -->    }<!-- [et_pb_line_break_holder] -->}<!-- [et_pb_line_break_holder] -->  <\/code><!-- [et_pb_line_break_holder] --><\/pre>\n<p>[\/et_pb_code][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; module_id=&#8221;applications-gyro&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;][et_pb_column_inner type=&#8221;4_4&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_code admin_label=&#8221;Applications &#8211; Gyro&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;]<\/p>\n<h3>Gyroscope Applications<\/h3>\n<p><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Gyroscopes are used in guidance systems in aircrafts, drones and autonomous vehicles. Smartphones can use gyroscopes to change the orientation of the screen depending on phone position. Gyroscopes are also used for camera stabilization and in virtual reality headsets.<!-- [et_pb_line_break_holder] --><\/pee>[\/et_pb_code][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner admin_label=&#8221;Row&#8221; _builder_version=&#8221;4.4.5&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;][et_pb_column_inner type=&#8221;1_3&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_image _builder_version=&#8221;4.6.6&#8243; src=&#8221;https:\/\/www.phidgets.com\/education\/wp-content\/uploads\/2020\/12\/spatial_gyro_drone.jpg&#8221; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; \/][\/et_pb_column_inner][et_pb_column_inner type=&#8221;1_3&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_image _builder_version=&#8221;4.6.6&#8243; src=&#8221;https:\/\/www.phidgets.com\/education\/wp-content\/uploads\/2020\/12\/spatial_gyro_phone.jpg&#8221; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; \/][\/et_pb_column_inner][et_pb_column_inner type=&#8221;1_3&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_image _builder_version=&#8221;4.6.6&#8243; src=&#8221;https:\/\/www.phidgets.com\/education\/wp-content\/uploads\/2020\/12\/spatial_gyro_camera.jpg&#8221; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; \/][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; module_id=&#8221;practice-gyro&#8221; module_class=&#8221;ph-hidden-anchor&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;][et_pb_column_inner type=&#8221;4_4&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_code admin_label=&#8221;Practice &#8211; row hidden anchor&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; \/][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner _builder_version=&#8221;4.4.5&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;][et_pb_column_inner type=&#8221;4_4&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_code admin_label=&#8221;Practice &#8211; Gyro&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;]<\/p>\n<h3>Gyroscope Practice<\/h3>\n<p><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Create the beginning fall detection system using your Spatial Phidget and Getting Started Kit. <\/pee><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><\/p>\n<ol><!-- [et_pb_line_break_holder] --><\/p>\n<li>Replace the Humidity Phidget in your Getting Started Kit with the Spatial Phidget.<\/li>\n<p><!-- [et_pb_line_break_holder] --><\/p>\n<li>Using the Z-Axis gyroscope data turn the Green LED on when the angular velocity is positive. When you spin the Spatial clockwise the Green LED should turn on.<\/li>\n<p><!-- [et_pb_line_break_holder] --><\/p>\n<li>Using the Z-Axis gyroscope data turn the Red LED on then the angular velocity is negative. When you turn  the Spatial counterclockwise the Red LED should turn on.<\/li>\n<p><!-- [et_pb_line_break_holder] --><\/p>\n<li>If the angular velocity is between -2 and positive 2, both LEDs should turn off.<\/li>\n<p><!-- [et_pb_line_break_holder] --><\/ol>\n<p><!-- [et_pb_line_break_holder] -->[\/et_pb_code][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; module_id=&#8221;write-code-mag&#8221; module_class=&#8221;ph-hidden-anchor&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;][et_pb_column_inner type=&#8221;4_4&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_code admin_label=&#8221;Write Code &#8211; row hidden anchor &#8211; mag&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; \/][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner _builder_version=&#8221;4.4.5&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; module_class=&#8221;ph-user-java&#8221;][et_pb_column_inner type=&#8221;4_4&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_code admin_label=&#8221;Code (Java) &#8211; Mag&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;]<\/p>\n<h3>Code (Java) &#8211; Magnetometer<\/h3>\n<p><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Create a file called <em>Spatial<\/em> and insert the following code. Run your code. Move your Spatial Phidget to see the output change.<\/pee><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Not your programming language? <a class=\"ph-toggle-settings\">Set my language and IDE<\/a>.<\/pee>[\/et_pb_code][et_pb_code admin_label=&#8221;Code Sample &#8211; Netbeans&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; module_class=&#8221;ph-user-netbeans&#8221;]<!-- Device tutorials: spatial --><!-- [et_pb_line_break_holder] --><\/p>\n<pre class=\"language-java\"><!-- [et_pb_line_break_holder] -->  <code><!-- [et_pb_line_break_holder] -->package spatial;<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->\/\/Add Phidgets Library<!-- [et_pb_line_break_holder] -->import com.phidget22.*;<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->public class Spatial{<!-- [et_pb_line_break_holder] -->    public static void main(String[] args) throws Exception {<!-- [et_pb_line_break_holder] -->        <!-- [et_pb_line_break_holder] -->        \/\/Create<!-- [et_pb_line_break_holder] -->       Magnetometer magnetometer = new Magnetometer();<!-- [et_pb_line_break_holder] -->        <!-- [et_pb_line_break_holder] -->        \/\/Open<!-- [et_pb_line_break_holder] -->       magnetometer.open(1000);<!-- [et_pb_line_break_holder] -->        <!-- [et_pb_line_break_holder] -->        \/\/Use your Phidgets<!-- [et_pb_line_break_holder] -->        while (true) {<!-- [et_pb_line_break_holder] -->            System.out.println(\"Magnetic Field: x = \" + magnetometer.getMagneticField()[0] + \" G | y = \" + magnetometer.getMagneticField()[1] + \" G | z = \" + magnetometer.getMagneticField()[2]+ \" G\");<!-- [et_pb_line_break_holder] -->            Thread.sleep(250);<!-- [et_pb_line_break_holder] -->        }<!-- [et_pb_line_break_holder] -->    }<!-- [et_pb_line_break_holder] -->}<!-- [et_pb_line_break_holder] -->  <\/code><!-- [et_pb_line_break_holder] --><\/pre>\n<p>[\/et_pb_code][et_pb_code admin_label=&#8221;Code Sample &#8211; Eclipse&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; module_class=&#8221;ph-user-eclipse&#8221;]<!-- Device tutorials: spatial --><!-- [et_pb_line_break_holder] --><\/p>\n<pre class=\"language-java\"><!-- [et_pb_line_break_holder] -->  <code><!-- [et_pb_line_break_holder] -->\/\/Add Phidgets Library<!-- [et_pb_line_break_holder] -->import com.phidget22.*;<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->public class Spatial{<!-- [et_pb_line_break_holder] -->    public static void main(String[] args) throws Exception {<!-- [et_pb_line_break_holder] -->        <!-- [et_pb_line_break_holder] -->        \/\/Create<!-- [et_pb_line_break_holder] -->       Magnetometer magnetometer = new Magnetometer();<!-- [et_pb_line_break_holder] -->        <!-- [et_pb_line_break_holder] -->        \/\/Open<!-- [et_pb_line_break_holder] -->       magnetometer.open(1000);<!-- [et_pb_line_break_holder] -->        <!-- [et_pb_line_break_holder] -->        \/\/Use your Phidgets<!-- [et_pb_line_break_holder] -->        while (true) {<!-- [et_pb_line_break_holder] -->            System.out.println(\"Magnetic Field: x = \" + magnetometer.getMagneticField()[0] + \" G | y = \" + magnetometer.getMagneticField()[1] + \" G | z = \" + magnetometer.getMagneticField()[2]+ \" G\");<!-- [et_pb_line_break_holder] -->            Thread.sleep(250);<!-- [et_pb_line_break_holder] -->        }<!-- [et_pb_line_break_holder] -->    }<!-- [et_pb_line_break_holder] -->}<!-- [et_pb_line_break_holder] -->  <\/code><!-- [et_pb_line_break_holder] --><\/pre>\n<p>[\/et_pb_code][et_pb_code admin_label=&#8221;Code Sample &#8211; Processing&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; module_class=&#8221;ph-user-processing&#8221;]<!-- Device tutorials: spatial --><!-- [et_pb_line_break_holder] --><\/p>\n<pre class=\"language-java\"><!-- [et_pb_line_break_holder] -->  <code><!-- [et_pb_line_break_holder] -->\/\/Add Phidgets Library<!-- [et_pb_line_break_holder] -->import com.phidget22.*;<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->\/\/Define<!-- [et_pb_line_break_holder] -->Magnetometer magnetometer;<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->void setup(){<!-- [et_pb_line_break_holder] -->  try{<!-- [et_pb_line_break_holder] -->    <!-- [et_pb_line_break_holder] -->    \/\/Create <!-- [et_pb_line_break_holder] -->    magnetometer = new Magnetometer();<!-- [et_pb_line_break_holder] -->    <!-- [et_pb_line_break_holder] -->    \/\/Open<!-- [et_pb_line_break_holder] -->    magnetometer.open(1000);<!-- [et_pb_line_break_holder] -->    <!-- [et_pb_line_break_holder] -->  }catch(Exception e){<!-- [et_pb_line_break_holder] -->    e.printStackTrace();<!-- [et_pb_line_break_holder] -->  }<!-- [et_pb_line_break_holder] -->}<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->void draw(){<!-- [et_pb_line_break_holder] -->  try{<!-- [et_pb_line_break_holder] -->    <!-- [et_pb_line_break_holder] -->    \/\/Use your Phidgets<!-- [et_pb_line_break_holder] -->    println(\"Magnetic Field: x = \" + magnetometer.getMagneticField()[0] + \" G | y = \" + magnetometer.getMagneticField()[1] + \" G | z = \" + magnetometer.getMagneticField()[2]+ \" G\");<!-- [et_pb_line_break_holder] -->    delay(250);<!-- [et_pb_line_break_holder] -->    <!-- [et_pb_line_break_holder] -->  }catch(Exception e){<!-- [et_pb_line_break_holder] -->    e.printStackTrace();<!-- [et_pb_line_break_holder] -->  }<!-- [et_pb_line_break_holder] -->}<!-- [et_pb_line_break_holder] -->  <\/code><!-- [et_pb_line_break_holder] --><\/pre>\n<p>[\/et_pb_code][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner _builder_version=&#8221;4.4.5&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; module_class=&#8221;ph-user-python&#8221;][et_pb_column_inner type=&#8221;4_4&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_code admin_label=&#8221;Code (Python) &#8211; Mag&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;]<\/p>\n<h3>Code (Python) &#8211; Magnetometer<\/h3>\n<p><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Create a file called <em>Spatial<\/em> and insert the following code. Run your code. Move your Spatial Phidget to see the output change.<\/pee><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Not your programming language? <a class=\"ph-toggle-settings\">Set my language and IDE<\/a>.<\/pee>[\/et_pb_code][et_pb_code admin_label=&#8221;Code sample&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;]<!-- Device tutorials: spatial --><!-- [et_pb_line_break_holder] --><\/p>\n<pre class=\"language-python\"><!-- [et_pb_line_break_holder] -->  <code><!-- [et_pb_line_break_holder] -->#Add Phidgets Library<!-- [et_pb_line_break_holder] -->from Phidget22.Phidget import *<!-- [et_pb_line_break_holder] -->from Phidget22.Devices.Magnetometer import *<!-- [et_pb_line_break_holder] -->#Required for sleep statement<!-- [et_pb_line_break_holder] -->import time<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->#Create<!-- [et_pb_line_break_holder] -->magnetometer = Magnetometer()<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->#Open<!-- [et_pb_line_break_holder] -->magnetometer.openWaitForAttachment(1000)<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->#Use your Phidgets<!-- [et_pb_line_break_holder] -->while (True):<!-- [et_pb_line_break_holder] -->    print(\"Magnetic Field: x = \" + str(magnetometer.getMagneticField()[0]) + \" G | y = \" + str(magnetometer.getMagneticField()[1]) + \" G | z = \" + str(magnetometer.getMagneticField()[2]) + \" G\")<!-- [et_pb_line_break_holder] -->    time.sleep(0.25)<!-- [et_pb_line_break_holder] -->  <\/code><!-- [et_pb_line_break_holder] --><\/pre>\n<p>[\/et_pb_code][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner _builder_version=&#8221;4.4.5&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; module_class=&#8221;ph-user-csharp&#8221;][et_pb_column_inner type=&#8221;4_4&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_code admin_label=&#8221;Code (C#) &#8211; Mag&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;]<\/p>\n<h3>Code (C#) &#8211; Magnetometer<\/h3>\n<p><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Create a file called <em>Spatial<\/em> and insert the following code. Run your code. Move your Spatial Phidget to see the output change.<\/pee><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Not your programming language? <a class=\"ph-toggle-settings\">Set my language and IDE<\/a>.<\/pee>[\/et_pb_code][et_pb_code admin_label=&#8221;Code sample&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;]<!-- Device tutorials: spatial --><!-- [et_pb_line_break_holder] --><\/p>\n<pre class=\"language-csharp\"><!-- [et_pb_line_break_holder] -->  <code><!-- [et_pb_line_break_holder] -->\/\/Add Phidgets Library<!-- [et_pb_line_break_holder] -->using Phidget22;<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->namespace Spatial<!-- [et_pb_line_break_holder] -->{<!-- [et_pb_line_break_holder] -->    class Program<!-- [et_pb_line_break_holder] -->    {<!-- [et_pb_line_break_holder] -->        static void Main(string[] args)<!-- [et_pb_line_break_holder] -->        {<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->            \/\/Create<!-- [et_pb_line_break_holder] -->            Magnetometer magnetometer = new Magnetometer();<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->            \/\/Open<!-- [et_pb_line_break_holder] -->            magnetometer.Open(1000);<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->            \/\/Use your Phidgets<!-- [et_pb_line_break_holder] -->            while (true)<!-- [et_pb_line_break_holder] -->            {<!-- [et_pb_line_break_holder] -->                System.Console.WriteLine(\"Magnetic field: x = \" + magnetometer.MagneticField[0] + \" G | y = \" + magnetometer.MagneticField[1] + \" G | z = \" + magnetometer.MagneticField[2] + \" G\");<!-- [et_pb_line_break_holder] -->                System.Threading.Thread.Sleep(250);<!-- [et_pb_line_break_holder] -->            }<!-- [et_pb_line_break_holder] -->        }<!-- [et_pb_line_break_holder] -->    }<!-- [et_pb_line_break_holder] -->}<!-- [et_pb_line_break_holder] -->  <\/code><!-- [et_pb_line_break_holder] --><\/pre>\n<p>[\/et_pb_code][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner _builder_version=&#8221;4.4.5&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; module_class=&#8221;ph-user-swift&#8221;][et_pb_column_inner type=&#8221;4_4&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_code admin_label=&#8221;Code (Swift) &#8211; Mag&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;]<\/p>\n<h3>Code (Swift) &#8211; Magnetometer<\/h3>\n<p><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Create a file called <em>Spatial<\/em> and insert the following code. Run your code. Move your Spatial Phidget to see the output change.<\/pee><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Not your programming language? <a class=\"ph-toggle-settings\">Set my language and IDE<\/a>.<\/pee><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>You will need to add three Labels.<\/pee>[\/et_pb_code][et_pb_image _builder_version=&#8221;4.4.1&#8243; src=&#8221;https:\/\/www.phidgets.com\/education\/wp-content\/uploads\/2020\/04\/spatial-1.png&#8221; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; disabled_on=&#8221;off|off|off&#8221; disabled=&#8221;off&#8221; \/][et_pb_code admin_label=&#8221;Code sample&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;]<!-- Device tutorials: spatial --><!-- [et_pb_line_break_holder] --><\/p>\n<pre class=\"language-swift\"><!-- [et_pb_line_break_holder] -->  <code><!-- [et_pb_line_break_holder] -->import Cocoa<!-- [et_pb_line_break_holder] -->\/\/Add Phidget Library<!-- [et_pb_line_break_holder] -->import Phidget22Swift<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->class ViewController: NSViewController {<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->    @IBOutlet weak var xLabel: NSTextField!<!-- [et_pb_line_break_holder] -->    @IBOutlet weak var yLabel: NSTextField!<!-- [et_pb_line_break_holder] -->    @IBOutlet weak var zLabel: NSTextField!<!-- [et_pb_line_break_holder] -->    <!-- [et_pb_line_break_holder] -->    \/\/Create<!-- [et_pb_line_break_holder] -->    let magnetometer = Magnetometer()<!-- [et_pb_line_break_holder] -->    <!-- [et_pb_line_break_holder] -->    override func viewDidLoad() {<!-- [et_pb_line_break_holder] -->        super.viewDidLoad()<!-- [et_pb_line_break_holder] -->        do{<!-- [et_pb_line_break_holder] -->            \/\/Subscribe to event<!-- [et_pb_line_break_holder] -->            let _ = magnetometer.setOnMagneticFieldChangeHandler(onMagneticFieldChange)<!-- [et_pb_line_break_holder] -->            <!-- [et_pb_line_break_holder] -->            \/\/Open<!-- [et_pb_line_break_holder] -->            try magnetometer.open()<!-- [et_pb_line_break_holder] -->        }catch{<!-- [et_pb_line_break_holder] -->            print(error)<!-- [et_pb_line_break_holder] -->        }<!-- [et_pb_line_break_holder] -->    }<!-- [et_pb_line_break_holder] -->    <!-- [et_pb_line_break_holder] -->func onMagneticFieldChange(sender: Magnetometer, data: (magneticField: [Double], timestamp: Double)) {<!-- [et_pb_line_break_holder] -->        DispatchQueue.main.async {<!-- [et_pb_line_break_holder] -->\t    \/\/Use information from your Phidget to change label<!-- [et_pb_line_break_holder] -->            self.xLabel.stringValue = \"X-axis: \" + String(data.magneticField[0]) + \" G\"<!-- [et_pb_line_break_holder] -->            self.yLabel.stringValue = \"Y-axis: \" + String(data.magneticField[1]) + \" \"G\u201d<!-- [et_pb_line_break_holder] -->            self.zLabel.stringValue = \"Z-axis: \" + String(data.magneticField[2]) + \" G\"<!-- [et_pb_line_break_holder] -->        }<!-- [et_pb_line_break_holder] -->    }<!-- [et_pb_line_break_holder] -->}<!-- [et_pb_line_break_holder] -->  <\/code><!-- [et_pb_line_break_holder] --><\/pre>\n<p>[\/et_pb_code][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; module_id=&#8221;applications-mag&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;][et_pb_column_inner type=&#8221;4_4&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_code admin_label=&#8221;Applications &#8211; Mag&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;]<\/p>\n<h3>Magnetometer Applications<\/h3>\n<p><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Magnetometers are sometimes referred to as \u201celectronic compasses\u201d. Electronic compasses work in exactly the same way as any other compass: They detect the Earth&#8217;s magnetic field and respond to it. The difference is that an electronic compass uses a magnetometer to detect the field as opposed to a small magnet. This allows them to be much more accurate and allows them to respond more quickly to changes in direction than a traditional compass ever could.<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->Magnetometers are also found in health care monitoring applications, land surveying, aircrafts and in land surveying applications to detect buried and submerged objects.<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><\/pee>[\/et_pb_code][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner admin_label=&#8221;Row&#8221; _builder_version=&#8221;4.4.5&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;][et_pb_column_inner type=&#8221;1_3&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_image _builder_version=&#8221;4.6.6&#8243; src=&#8221;https:\/\/www.phidgets.com\/education\/wp-content\/uploads\/2020\/12\/spatial_mag_airplane.jpg&#8221; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; \/][\/et_pb_column_inner][et_pb_column_inner type=&#8221;1_3&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_image _builder_version=&#8221;4.6.6&#8243; src=&#8221;https:\/\/www.phidgets.com\/education\/wp-content\/uploads\/2020\/12\/spatial_mag_compass.jpg&#8221; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; \/][\/et_pb_column_inner][et_pb_column_inner type=&#8221;1_3&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; module_id=&#8221;practice-mag&#8221; module_class=&#8221;ph-hidden-anchor&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;][et_pb_column_inner type=&#8221;4_4&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_code admin_label=&#8221;Practice &#8211; row hidden anchor &#8211; mag&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; \/][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner _builder_version=&#8221;4.4.5&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;][et_pb_column_inner type=&#8221;4_4&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_code admin_label=&#8221;Practice &#8211; Mag&#8221; _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243;]<\/p>\n<h3>Magnetometer Practice<\/h3>\n<p><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Coming soon!<\/pee><!-- [et_pb_line_break_holder] -->[\/et_pb_code][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner _builder_version=&#8221;4.6.6&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; module_id=&#8221;documentation&#8221; disabled=&#8221;off&#8221; disabled_on=&#8221;off|off|off&#8221;][et_pb_column_inner type=&#8221;4_4&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_text admin_label=&#8221;API Disclaimer&#8221; _builder_version=&#8221;4.6.6&#8243; text_text_shadow_horizontal_length=&#8221;text_text_shadow_style,%91object Object%93&#8243; text_text_shadow_horizontal_length_tablet=&#8221;0px&#8221; text_text_shadow_vertical_length=&#8221;text_text_shadow_style,%91object Object%93&#8243; text_text_shadow_vertical_length_tablet=&#8221;0px&#8221; text_text_shadow_blur_strength=&#8221;text_text_shadow_style,%91object Object%93&#8243; text_text_shadow_blur_strength_tablet=&#8221;1px&#8221; link_text_shadow_horizontal_length=&#8221;link_text_shadow_style,%91object Object%93&#8243; link_text_shadow_horizontal_length_tablet=&#8221;0px&#8221; link_text_shadow_vertical_length=&#8221;link_text_shadow_style,%91object Object%93&#8243; link_text_shadow_vertical_length_tablet=&#8221;0px&#8221; link_text_shadow_blur_strength=&#8221;link_text_shadow_style,%91object Object%93&#8243; link_text_shadow_blur_strength_tablet=&#8221;1px&#8221; ul_text_shadow_horizontal_length=&#8221;ul_text_shadow_style,%91object Object%93&#8243; ul_text_shadow_horizontal_length_tablet=&#8221;0px&#8221; ul_text_shadow_vertical_length=&#8221;ul_text_shadow_style,%91object Object%93&#8243; ul_text_shadow_vertical_length_tablet=&#8221;0px&#8221; ul_text_shadow_blur_strength=&#8221;ul_text_shadow_style,%91object Object%93&#8243; ul_text_shadow_blur_strength_tablet=&#8221;1px&#8221; ol_text_shadow_horizontal_length=&#8221;ol_text_shadow_style,%91object Object%93&#8243; ol_text_shadow_horizontal_length_tablet=&#8221;0px&#8221; ol_text_shadow_vertical_length=&#8221;ol_text_shadow_style,%91object Object%93&#8243; ol_text_shadow_vertical_length_tablet=&#8221;0px&#8221; ol_text_shadow_blur_strength=&#8221;ol_text_shadow_style,%91object Object%93&#8243; ol_text_shadow_blur_strength_tablet=&#8221;1px&#8221; quote_text_shadow_horizontal_length=&#8221;quote_text_shadow_style,%91object Object%93&#8243; quote_text_shadow_horizontal_length_tablet=&#8221;0px&#8221; quote_text_shadow_vertical_length=&#8221;quote_text_shadow_style,%91object Object%93&#8243; quote_text_shadow_vertical_length_tablet=&#8221;0px&#8221; quote_text_shadow_blur_strength=&#8221;quote_text_shadow_style,%91object Object%93&#8243; quote_text_shadow_blur_strength_tablet=&#8221;1px&#8221; header_text_shadow_horizontal_length=&#8221;header_text_shadow_style,%91object Object%93&#8243; header_text_shadow_horizontal_length_tablet=&#8221;0px&#8221; header_text_shadow_vertical_length=&#8221;header_text_shadow_style,%91object Object%93&#8243; header_text_shadow_vertical_length_tablet=&#8221;0px&#8221; header_text_shadow_blur_strength=&#8221;header_text_shadow_style,%91object Object%93&#8243; header_text_shadow_blur_strength_tablet=&#8221;1px&#8221; header_2_text_shadow_horizontal_length=&#8221;header_2_text_shadow_style,%91object Object%93&#8243; header_2_text_shadow_horizontal_length_tablet=&#8221;0px&#8221; header_2_text_shadow_vertical_length=&#8221;header_2_text_shadow_style,%91object Object%93&#8243; header_2_text_shadow_vertical_length_tablet=&#8221;0px&#8221; header_2_text_shadow_blur_strength=&#8221;header_2_text_shadow_style,%91object Object%93&#8243; header_2_text_shadow_blur_strength_tablet=&#8221;1px&#8221; header_3_text_shadow_horizontal_length=&#8221;header_3_text_shadow_style,%91object Object%93&#8243; header_3_text_shadow_horizontal_length_tablet=&#8221;0px&#8221; header_3_text_shadow_vertical_length=&#8221;header_3_text_shadow_style,%91object Object%93&#8243; header_3_text_shadow_vertical_length_tablet=&#8221;0px&#8221; header_3_text_shadow_blur_strength=&#8221;header_3_text_shadow_style,%91object Object%93&#8243; header_3_text_shadow_blur_strength_tablet=&#8221;1px&#8221; header_4_text_shadow_horizontal_length=&#8221;header_4_text_shadow_style,%91object Object%93&#8243; header_4_text_shadow_horizontal_length_tablet=&#8221;0px&#8221; header_4_text_shadow_vertical_length=&#8221;header_4_text_shadow_style,%91object Object%93&#8243; header_4_text_shadow_vertical_length_tablet=&#8221;0px&#8221; header_4_text_shadow_blur_strength=&#8221;header_4_text_shadow_style,%91object Object%93&#8243; header_4_text_shadow_blur_strength_tablet=&#8221;1px&#8221; header_5_text_shadow_horizontal_length=&#8221;header_5_text_shadow_style,%91object Object%93&#8243; header_5_text_shadow_horizontal_length_tablet=&#8221;0px&#8221; header_5_text_shadow_vertical_length=&#8221;header_5_text_shadow_style,%91object Object%93&#8243; header_5_text_shadow_vertical_length_tablet=&#8221;0px&#8221; header_5_text_shadow_blur_strength=&#8221;header_5_text_shadow_style,%91object Object%93&#8243; header_5_text_shadow_blur_strength_tablet=&#8221;1px&#8221; header_6_text_shadow_horizontal_length=&#8221;header_6_text_shadow_style,%91object Object%93&#8243; header_6_text_shadow_horizontal_length_tablet=&#8221;0px&#8221; header_6_text_shadow_vertical_length=&#8221;header_6_text_shadow_style,%91object Object%93&#8243; header_6_text_shadow_vertical_length_tablet=&#8221;0px&#8221; header_6_text_shadow_blur_strength=&#8221;header_6_text_shadow_style,%91object Object%93&#8243; header_6_text_shadow_blur_strength_tablet=&#8221;1px&#8221; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; saved_tabs=&#8221;all&#8221; global_module=&#8221;3821&#8243;]<\/p>\n<p>Check out the advanced lesson <a href=\"https:\/\/www.phidgets.com\/education\/learn\/getting-started-kit-tutorial\/getting-started-kit-advanced-11-sensorapi\/\" target=\"_blank\" rel=\"noopener noreferrer\">Using the Sensor API<\/a> before you use the API for the first time.<\/p>\n<p>[\/et_pb_text][et_pb_toggle admin_label=&#8221;API&#8221; _builder_version=&#8221;4.6.6&#8243; title=&#8221;API&#8221; text_shadow_horizontal_length=&#8221;text_shadow_style,%91object Object%93&#8243; text_shadow_horizontal_length_tablet=&#8221;0px&#8221; text_shadow_vertical_length=&#8221;text_shadow_style,%91object Object%93&#8243; text_shadow_vertical_length_tablet=&#8221;0px&#8221; text_shadow_blur_strength=&#8221;text_shadow_style,%91object Object%93&#8243; text_shadow_blur_strength_tablet=&#8221;1px&#8221; title_text_shadow_horizontal_length=&#8221;title_text_shadow_style,%91object Object%93&#8243; title_text_shadow_horizontal_length_tablet=&#8221;0px&#8221; title_text_shadow_vertical_length=&#8221;title_text_shadow_style,%91object Object%93&#8243; title_text_shadow_vertical_length_tablet=&#8221;0px&#8221; title_text_shadow_blur_strength=&#8221;title_text_shadow_style,%91object Object%93&#8243; title_text_shadow_blur_strength_tablet=&#8221;1px&#8221; closed_title_text_shadow_horizontal_length=&#8221;closed_title_text_shadow_style,%91object Object%93&#8243; closed_title_text_shadow_horizontal_length_tablet=&#8221;0px&#8221; closed_title_text_shadow_vertical_length=&#8221;closed_title_text_shadow_style,%91object Object%93&#8243; closed_title_text_shadow_vertical_length_tablet=&#8221;0px&#8221; closed_title_text_shadow_blur_strength=&#8221;closed_title_text_shadow_style,%91object Object%93&#8243; closed_title_text_shadow_blur_strength_tablet=&#8221;1px&#8221; body_text_shadow_horizontal_length=&#8221;body_text_shadow_style,%91object Object%93&#8243; body_text_shadow_horizontal_length_tablet=&#8221;0px&#8221; body_text_shadow_vertical_length=&#8221;body_text_shadow_style,%91object Object%93&#8243; body_text_shadow_vertical_length_tablet=&#8221;0px&#8221; body_text_shadow_blur_strength=&#8221;body_text_shadow_style,%91object Object%93&#8243; body_text_shadow_blur_strength_tablet=&#8221;1px&#8221; body_link_text_shadow_horizontal_length=&#8221;body_link_text_shadow_style,%91object Object%93&#8243; body_link_text_shadow_horizontal_length_tablet=&#8221;0px&#8221; body_link_text_shadow_vertical_length=&#8221;body_link_text_shadow_style,%91object Object%93&#8243; body_link_text_shadow_vertical_length_tablet=&#8221;0px&#8221; body_link_text_shadow_blur_strength=&#8221;body_link_text_shadow_style,%91object Object%93&#8243; body_link_text_shadow_blur_strength_tablet=&#8221;1px&#8221; body_ul_text_shadow_horizontal_length=&#8221;body_ul_text_shadow_style,%91object Object%93&#8243; body_ul_text_shadow_horizontal_length_tablet=&#8221;0px&#8221; body_ul_text_shadow_vertical_length=&#8221;body_ul_text_shadow_style,%91object Object%93&#8243; body_ul_text_shadow_vertical_length_tablet=&#8221;0px&#8221; body_ul_text_shadow_blur_strength=&#8221;body_ul_text_shadow_style,%91object Object%93&#8243; body_ul_text_shadow_blur_strength_tablet=&#8221;1px&#8221; body_ol_text_shadow_horizontal_length=&#8221;body_ol_text_shadow_style,%91object Object%93&#8243; body_ol_text_shadow_horizontal_length_tablet=&#8221;0px&#8221; body_ol_text_shadow_vertical_length=&#8221;body_ol_text_shadow_style,%91object Object%93&#8243; body_ol_text_shadow_vertical_length_tablet=&#8221;0px&#8221; body_ol_text_shadow_blur_strength=&#8221;body_ol_text_shadow_style,%91object Object%93&#8243; body_ol_text_shadow_blur_strength_tablet=&#8221;1px&#8221; body_quote_text_shadow_horizontal_length=&#8221;body_quote_text_shadow_style,%91object Object%93&#8243; body_quote_text_shadow_horizontal_length_tablet=&#8221;0px&#8221; body_quote_text_shadow_vertical_length=&#8221;body_quote_text_shadow_style,%91object Object%93&#8243; body_quote_text_shadow_vertical_length_tablet=&#8221;0px&#8221; body_quote_text_shadow_blur_strength=&#8221;body_quote_text_shadow_style,%91object Object%93&#8243; body_quote_text_shadow_blur_strength_tablet=&#8221;1px&#8221; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; module_id=&#8221;api-MOT1101_0&#8243; \/][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner _builder_version=&#8221;4.4.1&#8243; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; module_id=&#8221;troubleshoot&#8221;][et_pb_column_inner type=&#8221;4_4&#8243; saved_specialty_column_type=&#8221;3_4&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221; saved_specialty_column_type=&#8221;3_4&#8243;][et_pb_toggle admin_label=&#8221;Troubleshoot&#8221; _builder_version=&#8221;4.4.1&#8243; title=&#8221;Troubleshoot&#8221; text_shadow_horizontal_length=&#8221;text_shadow_style,%91object Object%93&#8243; text_shadow_horizontal_length_tablet=&#8221;0px&#8221; text_shadow_vertical_length=&#8221;text_shadow_style,%91object Object%93&#8243; text_shadow_vertical_length_tablet=&#8221;0px&#8221; text_shadow_blur_strength=&#8221;text_shadow_style,%91object Object%93&#8243; text_shadow_blur_strength_tablet=&#8221;1px&#8221; title_text_shadow_horizontal_length=&#8221;title_text_shadow_style,%91object Object%93&#8243; title_text_shadow_horizontal_length_tablet=&#8221;0px&#8221; title_text_shadow_vertical_length=&#8221;title_text_shadow_style,%91object Object%93&#8243; title_text_shadow_vertical_length_tablet=&#8221;0px&#8221; title_text_shadow_blur_strength=&#8221;title_text_shadow_style,%91object Object%93&#8243; title_text_shadow_blur_strength_tablet=&#8221;1px&#8221; closed_title_text_shadow_horizontal_length=&#8221;closed_title_text_shadow_style,%91object Object%93&#8243; closed_title_text_shadow_horizontal_length_tablet=&#8221;0px&#8221; closed_title_text_shadow_vertical_length=&#8221;closed_title_text_shadow_style,%91object Object%93&#8243; closed_title_text_shadow_vertical_length_tablet=&#8221;0px&#8221; closed_title_text_shadow_blur_strength=&#8221;closed_title_text_shadow_style,%91object Object%93&#8243; closed_title_text_shadow_blur_strength_tablet=&#8221;1px&#8221; body_text_shadow_horizontal_length=&#8221;body_text_shadow_style,%91object Object%93&#8243; body_text_shadow_horizontal_length_tablet=&#8221;0px&#8221; body_text_shadow_vertical_length=&#8221;body_text_shadow_style,%91object Object%93&#8243; body_text_shadow_vertical_length_tablet=&#8221;0px&#8221; body_text_shadow_blur_strength=&#8221;body_text_shadow_style,%91object Object%93&#8243; body_text_shadow_blur_strength_tablet=&#8221;1px&#8221; body_link_text_shadow_horizontal_length=&#8221;body_link_text_shadow_style,%91object Object%93&#8243; body_link_text_shadow_horizontal_length_tablet=&#8221;0px&#8221; body_link_text_shadow_vertical_length=&#8221;body_link_text_shadow_style,%91object Object%93&#8243; body_link_text_shadow_vertical_length_tablet=&#8221;0px&#8221; body_link_text_shadow_blur_strength=&#8221;body_link_text_shadow_style,%91object Object%93&#8243; body_link_text_shadow_blur_strength_tablet=&#8221;1px&#8221; body_ul_text_shadow_horizontal_length=&#8221;body_ul_text_shadow_style,%91object Object%93&#8243; body_ul_text_shadow_horizontal_length_tablet=&#8221;0px&#8221; body_ul_text_shadow_vertical_length=&#8221;body_ul_text_shadow_style,%91object Object%93&#8243; body_ul_text_shadow_vertical_length_tablet=&#8221;0px&#8221; body_ul_text_shadow_blur_strength=&#8221;body_ul_text_shadow_style,%91object Object%93&#8243; body_ul_text_shadow_blur_strength_tablet=&#8221;1px&#8221; body_ol_text_shadow_horizontal_length=&#8221;body_ol_text_shadow_style,%91object Object%93&#8243; body_ol_text_shadow_horizontal_length_tablet=&#8221;0px&#8221; body_ol_text_shadow_vertical_length=&#8221;body_ol_text_shadow_style,%91object Object%93&#8243; body_ol_text_shadow_vertical_length_tablet=&#8221;0px&#8221; body_ol_text_shadow_blur_strength=&#8221;body_ol_text_shadow_style,%91object Object%93&#8243; body_ol_text_shadow_blur_strength_tablet=&#8221;1px&#8221; body_quote_text_shadow_horizontal_length=&#8221;body_quote_text_shadow_style,%91object Object%93&#8243; body_quote_text_shadow_horizontal_length_tablet=&#8221;0px&#8221; body_quote_text_shadow_vertical_length=&#8221;body_quote_text_shadow_style,%91object Object%93&#8243; body_quote_text_shadow_vertical_length_tablet=&#8221;0px&#8221; body_quote_text_shadow_blur_strength=&#8221;body_quote_text_shadow_style,%91object Object%93&#8243; body_quote_text_shadow_blur_strength_tablet=&#8221;1px&#8221; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243;]<\/p>\n<ol>\n<li>Make sure everything is plugged in properly and your VINT Hub is connected to your computer\n<\/li>\n<li>Stop running other programs that are using your Phidgets before running a program.<\/li>\n<\/ol>\n<p>If these do not solve your issue visit the <a href=\"\/education\/learn\/advanced-troubleshooting\/ \" target=\"_blank\" rel=\"noopener noreferrer\">Advanced Troubleshooting Page<\/a>.<\/p>\n<p>[\/et_pb_toggle][\/et_pb_column_inner][\/et_pb_row_inner][\/et_pb_column][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p><div class=\"et_pb_row et_pb_row_0 et_pb_row_empty\">\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t<\/div> package spatial;\/\/Add Phidgets Libraryimport com.phidget22.*;public class Spatial{ public static void main(String[] args) throws Exception { \/\/Create Accelerometer accelerometer = new Accelerometer(); \/\/Open accelerometer.open(1000); \/\/Use your Phidgets while (true) { System.out.println(&#8220;Acceleration: x = &#8221; + accelerometer.getAcceleration()[0] + &#8221; g | y = &#8221; + accelerometer.getAcceleration()[1] + &#8221; g | z = &#8221; + accelerometer.getAcceleration()[2]+ &#8221; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":623,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_et_pb_use_builder":"on","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"class_list":["post-727","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.phidgets.com\/education\/wp-json\/wp\/v2\/pages\/727","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.phidgets.com\/education\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.phidgets.com\/education\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.phidgets.com\/education\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.phidgets.com\/education\/wp-json\/wp\/v2\/comments?post=727"}],"version-history":[{"count":28,"href":"https:\/\/www.phidgets.com\/education\/wp-json\/wp\/v2\/pages\/727\/revisions"}],"predecessor-version":[{"id":6585,"href":"https:\/\/www.phidgets.com\/education\/wp-json\/wp\/v2\/pages\/727\/revisions\/6585"}],"up":[{"embeddable":true,"href":"https:\/\/www.phidgets.com\/education\/wp-json\/wp\/v2\/pages\/623"}],"wp:attachment":[{"href":"https:\/\/www.phidgets.com\/education\/wp-json\/wp\/v2\/media?parent=727"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}