{"id":3949,"date":"2020-12-08T04:05:15","date_gmt":"2020-12-07T21:05:15","guid":{"rendered":"https:\/\/www.phidgets.com\/education\/?page_id=3949"},"modified":"2022-06-01T03:43:46","modified_gmt":"2022-05-31T20:43:46","slug":"dice-roll","status":"publish","type":"page","link":"https:\/\/www.phidgets.com\/education\/learn\/projects\/dice-roll\/","title":{"rendered":"Phidgets Projects &#8211; Dice Roll"},"content":{"rendered":"<p>[et_pb_section bb_built=&#8221;1&#8243; specialty=&#8221;off&#8221; next_background_color=&#8221;#000000&#8243; _builder_version=&#8221;4.4.1&#8243; custom_padding=&#8221;||0px|&#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_row _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;][et_pb_column type=&#8221;1_2&#8243; custom_padding__hover=&#8221;|||&#8221; custom_padding=&#8221;|||&#8221;][et_pb_code admin_label=&#8221;Rolling Dice&#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-overline-text\"><!-- [et_pb_line_break_holder] --><a href=\"\/education\/learn\/projects\">Projects<\/a><!-- [et_pb_line_break_holder] -->    <\/div>\n<p><!-- [et_pb_line_break_holder] --><\/p>\n<h1>Dice Roll<\/h1>\n<p>[\/et_pb_code][et_pb_code admin_label=&#8221;Description&#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;]<pee>Use your Phidget Accelerometer to simulate shaking dice. By calculating the total magnitude of the acceleration and using a random number generator, you can detect shaking and produce a random dice roll.<\/pee>[\/et_pb_code][et_pb_code admin_label=&#8221;ph-button-cta: Start&#8221; _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;]<a class=\"ph-button-cta\" href=\"#setup\"><!-- [et_pb_line_break_holder] -->  <\/p>\n<div class=\"ph-button-cta__icon\"><\/div>\n<p><!-- [et_pb_line_break_holder] -->  Start<!-- [et_pb_line_break_holder] --><\/a>[\/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.6.6&#8243; src=&#8221;https:\/\/www.phidgets.com\/education\/wp-content\/uploads\/2020\/12\/projects_dice.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; _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; prev_background_color=&#8221;#000000&#8243;][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=\"#setup\" class=\"ph-vertical-nav-item\">Setup<\/a><!-- [et_pb_line_break_holder] -->  <a href=\"#write-code\" class=\"ph-vertical-nav-item\">Write Code<\/a><!-- [et_pb_line_break_holder] -->  <a href=\"#practice\" class=\"ph-vertical-nav-item\">Practice<\/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; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; module_id=&#8221;setup&#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;Setup&#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_id=&#8221;setup&#8221;]<\/p>\n<h2>Setup<\/h2>\n<p><!-- [et_pb_line_break_holder] --><pee>Before getting started, make sure you have the following parts.<!\u2013- [et_pb_br_holder] -\u2013><!\u2013- [et_pb_br_holder] -\u2013><strong>Note:<\/strong> you can also use the Phidget Spatial or any Phidget with an accelerometer for this project.<\/pee>[\/et_pb_code][\/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; custom_padding=&#8221;||0px|&#8221;][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_code admin_label=&#8221;Part: 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; saved_tabs=&#8221;all&#8221;]<\/p>\n<div class=\"ph-part-card\"><!-- [et_pb_line_break_holder] -->  <\/p>\n<div class=\"ph-part-card__top\"><!-- [et_pb_line_break_holder] -->    <\/p>\n<div class=\"ph-part-card__type\"><!-- [et_pb_line_break_holder] -->      <\/p>\n<div class=\"ph-overline-text\"><!-- [et_pb_line_break_holder] -->        <a href=\"\">Sensors \/<\/a><!-- [et_pb_line_break_holder] -->        <a href=\"\">MOT1100<\/a><!-- [et_pb_line_break_holder] -->      <\/div>\n<p><!-- [et_pb_line_break_holder] -->    <\/div>\n<p><!-- [et_pb_line_break_holder] -->    <\/p>\n<div class=\"ph-part-card__title\"><!-- [et_pb_line_break_holder] -->      <\/p>\n<h3>Accelerometer Phidget<\/h3>\n<p><!-- [et_pb_line_break_holder] -->    <\/div>\n<p><!-- [et_pb_line_break_holder] -->  <\/div>\n<p><!-- [et_pb_line_break_holder] -->  <\/p>\n<div class=\"ph-part-card__bottom\"><!-- [et_pb_line_break_holder] -->    <img decoding=\"async\" src=\"\/education\/wp-content\/uploads\/2020\/12\/part-accel.jpg\"><!-- [et_pb_line_break_holder] -->  <\/div>\n<p><!-- [et_pb_line_break_holder] --><\/div>\n<p>[\/et_pb_code][et_pb_code admin_label=&#8221;Part: phidget cable&#8221; _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; saved_tabs=&#8221;all&#8221;]<\/p>\n<div class=\"ph-part-card\"><!-- [et_pb_line_break_holder] -->  <\/p>\n<div class=\"ph-part-card__top\"><!-- [et_pb_line_break_holder] -->    <\/p>\n<div class=\"ph-part-card__type\"><!-- [et_pb_line_break_holder] -->      <\/p>\n<div class=\"ph-overline-text\"><!-- [et_pb_line_break_holder] -->        <a href=\"\">Cables\/<\/a><!-- [et_pb_line_break_holder] -->        <a href=\"\">3003<\/a><!-- [et_pb_line_break_holder] -->      <\/div>\n<p><!-- [et_pb_line_break_holder] -->    <\/div>\n<p><!-- [et_pb_line_break_holder] -->    <\/p>\n<div class=\"ph-part-card__title\"><!-- [et_pb_line_break_holder] -->      <\/p>\n<h3>Phidget cable<\/h3>\n<p><!-- [et_pb_line_break_holder] -->    <\/div>\n<p><!-- [et_pb_line_break_holder] -->  <\/div>\n<p><!-- [et_pb_line_break_holder] -->  <\/p>\n<div class=\"ph-part-card__bottom\"><!-- [et_pb_line_break_holder] -->    <img decoding=\"async\" src=\"\/education\/wp-content\/uploads\/2020\/04\/part-phidget-cable.jpg\"><!-- [et_pb_line_break_holder] -->  <\/div>\n<p><!-- [et_pb_line_break_holder] --><\/div>\n<p>[\/et_pb_code][\/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_code admin_label=&#8221;Part: vint&#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; saved_tabs=&#8221;all&#8221;]<\/p>\n<div class=\"ph-part-card\"><!-- [et_pb_line_break_holder] -->  <\/p>\n<div class=\"ph-part-card__top\"><!-- [et_pb_line_break_holder] -->    <\/p>\n<div class=\"ph-part-card__type\"><!-- [et_pb_line_break_holder] -->      <\/p>\n<div class=\"ph-overline-text\"><!-- [et_pb_line_break_holder] -->        <a href=\"\">Controllers \/<\/a><!-- [et_pb_line_break_holder] -->        <a href=\"\">hub0000<\/a><!-- [et_pb_line_break_holder] -->      <\/div>\n<p><!-- [et_pb_line_break_holder] -->    <\/div>\n<p><!-- [et_pb_line_break_holder] -->    <\/p>\n<div class=\"ph-part-card__title\"><!-- [et_pb_line_break_holder] -->      <\/p>\n<h3>VINT Hub<\/h3>\n<p><!-- [et_pb_line_break_holder] -->    <\/div>\n<p><!-- [et_pb_line_break_holder] -->  <\/div>\n<p><!-- [et_pb_line_break_holder] -->  <\/p>\n<div class=\"ph-part-card__bottom\"><!-- [et_pb_line_break_holder] -->    <img decoding=\"async\" src=\"\/education\/wp-content\/uploads\/2020\/04\/part-vint.jpg\"><!-- [et_pb_line_break_holder] -->  <\/div>\n<p><!-- [et_pb_line_break_holder] --><\/div>\n<p>[\/et_pb_code][\/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_code admin_label=&#8221;Part: usb cable&#8221; _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; saved_tabs=&#8221;all&#8221;]<\/p>\n<div class=\"ph-part-card\"><!-- [et_pb_line_break_holder] -->  <\/p>\n<div class=\"ph-part-card__top\"><!-- [et_pb_line_break_holder] -->    <\/p>\n<div class=\"ph-part-card__type\"><!-- [et_pb_line_break_holder] -->      <\/p>\n<div class=\"ph-overline-text\"><!-- [et_pb_line_break_holder] -->        <a href=\"\">Cables\/<\/a><!-- [et_pb_line_break_holder] -->        <a href=\"\">3018<\/a><!-- [et_pb_line_break_holder] -->      <\/div>\n<p><!-- [et_pb_line_break_holder] -->    <\/div>\n<p><!-- [et_pb_line_break_holder] -->    <\/p>\n<div class=\"ph-part-card__title\"><!-- [et_pb_line_break_holder] -->      <\/p>\n<h3>USB cable<\/h3>\n<p><!-- [et_pb_line_break_holder] -->    <\/div>\n<p><!-- [et_pb_line_break_holder] -->  <\/div>\n<p><!-- [et_pb_line_break_holder] -->  <\/p>\n<div class=\"ph-part-card__bottom\"><!-- [et_pb_line_break_holder] -->    <img decoding=\"async\" src=\"\/education\/wp-content\/uploads\/2020\/04\/part-usb-cable.jpg\"><!-- [et_pb_line_break_holder] -->  <\/div>\n<p><!-- [et_pb_line_break_holder] --><\/div>\n<p>[\/et_pb_code][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner admin_label=&#8221;Row&#8221;][et_pb_column_inner type=&#8221;1_2&#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;Step 1&#8243; _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>Step 1<\/h3>\n<p><!-- [et_pb_line_break_holder] --><pee>Attach the Accelerometer Phidget to the VINT Hub and VINT Hub to your computer<\/pee>[\/et_pb_code][\/et_pb_column_inner][et_pb_column_inner type=&#8221;1_2&#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\/11\/mot1100_setup2.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; show_in_lightbox=&#8221;on&#8221; \/][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner admin_label=&#8221;Row&#8221; disabled_on=&#8221;on|on|on&#8221; disabled=&#8221;on&#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 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; (invisible anchor)&#8221; _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;move&#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][\/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_class=&#8221;ph-user-java&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; module_id=&#8221;write-code&#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;Write code Java&#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<h2>Write Code (Java)<\/h2>\n<p><!-- [et_pb_line_break_holder] --><pee>Copy the code below into a new Java project. If you need a reminder of how to do this, revisit the <a href=\"\/education\/learn\/getting-started-kit-tutorial\/configure-ide\">Getting Started Course.<\/a><!\u2013- [et_pb_br_holder] -\u2013><!\u2013- [et_pb_br_holder] -\u2013><!-- [et_pb_line_break_holder] -->Not your programming language? <a class=\"ph-toggle-settings\">Set your preferences<\/a> so we can display relevant code examples<\/pee>[\/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;]<!-- Dice Roll --><!-- [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 DiceRoll {<!-- [et_pb_line_break_holder] --><!-- [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] -->            \/\/Get acceleration values<!-- [et_pb_line_break_holder] -->            double x = accelerometer.getAcceleration()[0];<!-- [et_pb_line_break_holder] -->            double y = accelerometer.getAcceleration()[1];<!-- [et_pb_line_break_holder] -->            double z = accelerometer.getAcceleration()[2];<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->            \/\/calculate the magnitude of the acceleration and print it<!-- [et_pb_line_break_holder] -->            double totalAccel = Math.sqrt(x * x + y * y + z * z);<!-- [et_pb_line_break_holder] -->            <!-- [et_pb_line_break_holder] -->            \/\/compare magnitude to a threshold value<!-- [et_pb_line_break_holder] -->            if(totalAccel > 3.0){<!-- [et_pb_line_break_holder] -->                System.out.println(\"Shaking\");<!-- [et_pb_line_break_holder] -->            }<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->            Thread.sleep(150);<!-- [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; 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;]<!-- Dice Roll --><!-- [et_pb_line_break_holder] --><\/p>\n<pre class=\"language-java\"><!-- [et_pb_line_break_holder] -->  <code><!-- [et_pb_line_break_holder] -->package diceroll;<!-- [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 DiceRoll {<!-- [et_pb_line_break_holder] --><!-- [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] -->            \/\/Get acceleration values<!-- [et_pb_line_break_holder] -->            double x = accelerometer.getAcceleration()[0];<!-- [et_pb_line_break_holder] -->            double y = accelerometer.getAcceleration()[1];<!-- [et_pb_line_break_holder] -->            double z = accelerometer.getAcceleration()[2];<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->            \/\/calculate the magnitude of the acceleration and print it<!-- [et_pb_line_break_holder] -->            double totalAccel = Math.sqrt(x * x + y * y + z * z);<!-- [et_pb_line_break_holder] -->            <!-- [et_pb_line_break_holder] -->            \/\/compare magnitude to a threshold value<!-- [et_pb_line_break_holder] -->            if(totalAccel > 3.0){<!-- [et_pb_line_break_holder] -->                System.out.println(\"Shaking\");<!-- [et_pb_line_break_holder] -->            }<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->            Thread.sleep(150);<!-- [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_class=&#8221;ph-user-python&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; module_id=&#8221;write-code&#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;Write code Python&#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<h2>Write Code (Python)<\/h2>\n<p><!-- [et_pb_line_break_holder] --><pee>Copy the code below into a new Python project. If you need a reminder of how to do this, revisit the <a href=\"\/education\/learn\/getting-started-kit-tutorial\/configure-ide\">Getting Started Course.<\/a><!\u2013- [et_pb_br_holder] -\u2013><!\u2013- [et_pb_br_holder] -\u2013><!-- [et_pb_line_break_holder] -->Not your programming language? <a class=\"ph-toggle-settings\">Set your preferences<\/a> so we can display relevant code examples<\/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;]<!-- Dice Roll --><!-- [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] -->#Required for math operations<!-- [et_pb_line_break_holder] -->import math<!-- [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] -->    #Get acceleration values<!-- [et_pb_line_break_holder] -->    x = accelerometer.getAcceleration()[0]<!-- [et_pb_line_break_holder] -->    y = accelerometer.getAcceleration()[1]<!-- [et_pb_line_break_holder] -->    z = accelerometer.getAcceleration()[2]<!-- [et_pb_line_break_holder] -->    <!-- [et_pb_line_break_holder] -->    #calculate the magnitude of the acceleration<!-- [et_pb_line_break_holder] -->    totalAccel = math.sqrt(x*x + y*y + z*z)<!-- [et_pb_line_break_holder] -->    <!-- [et_pb_line_break_holder] -->    #compare magnitude to a threshold value<!-- [et_pb_line_break_holder] -->    if(totalAccel > 3):<!-- [et_pb_line_break_holder] -->        print(\"Shaking\")<!-- [et_pb_line_break_holder] -->    <!-- [et_pb_line_break_holder] -->    time.sleep(0.15)<!-- [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.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_class=&#8221;ph-user-csharp&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; module_id=&#8221;write-code&#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;Write code C#&#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<h2>Write Code (C#)<\/h2>\n<p><!-- [et_pb_line_break_holder] --><pee>Copy the code below into a new C# project. If you need a reminder of how to do this, revisit the <a href=\"\/education\/learn\/getting-started-kit-tutorial\/configure-ide\">Getting Started Course.<\/a><!\u2013- [et_pb_br_holder] -\u2013><!\u2013- [et_pb_br_holder] -\u2013><!-- [et_pb_line_break_holder] -->Not your programming language? <a class=\"ph-toggle-settings\">Set your preferences<\/a> so we can display relevant code examples<\/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;]<!-- Dice Roll --><!-- [et_pb_line_break_holder] --><\/p>\n<pre class=\"language-csharp\"><!-- [et_pb_line_break_holder] -->  <code><!-- [et_pb_line_break_holder] -->using System;<!-- [et_pb_line_break_holder] -->using Phidget22;<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->namespace DiceRoll<!-- [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] -->            \/\/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] -->                \/\/Get acceleration values<!-- [et_pb_line_break_holder] -->                double x = accelerometer.Acceleration[0];<!-- [et_pb_line_break_holder] -->                double y = accelerometer.Acceleration[1];<!-- [et_pb_line_break_holder] -->                double z = accelerometer.Acceleration[2];<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->                \/\/calculate the magnitude of the acceleration<!-- [et_pb_line_break_holder] -->                double totalAccel = Math.Sqrt(x * x + y * y + z * z);<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->                \/\/compare magnitude to a threshold value<!-- [et_pb_line_break_holder] -->                if (totalAccel > 3.0)<!-- [et_pb_line_break_holder] -->                {<!-- [et_pb_line_break_holder] -->                    Console.WriteLine(\"Shaking\");<!-- [et_pb_line_break_holder] -->                }<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->                System.Threading.Thread.Sleep(150);<!-- [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.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_class=&#8221;ph-user-swift&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; module_id=&#8221;write-code&#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;Write code Swift&#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<h2>Write Code (Swift)<\/h2>\n<p><!-- [et_pb_line_break_holder] --><pee>Copy the code below into a new Swift project. If you need a reminder of how to do this, revisit the <a href=\"\/education\/learn\/getting-started-kit-tutorial\/configure-ide\">Getting Started Course.<\/a><!\u2013- [et_pb_br_holder] -\u2013><!\u2013- [et_pb_br_holder] -\u2013><!-- [et_pb_line_break_holder] -->Not your programming language? <a class=\"ph-toggle-settings\">Set your preferences<\/a> so we can display relevant code examples<\/pee>[\/et_pb_code][et_pb_image _builder_version=&#8221;4.6.6&#8243; src=&#8221;https:\/\/www.phidgets.com\/education\/wp-content\/uploads\/2020\/12\/swift_dice.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; align=&#8221;center&#8221; width=&#8221;75%&#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;]<!-- Plant monitoring --><!-- [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] --><!-- [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 diceLabel: 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] -->        <!-- [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] -->            \/\/Get acceleration values<!-- [et_pb_line_break_holder] -->            let x = data.acceleration[0]<!-- [et_pb_line_break_holder] -->            let y = data.acceleration[1]<!-- [et_pb_line_break_holder] -->            let z = data.acceleration[2]<!-- [et_pb_line_break_holder] -->            <!-- [et_pb_line_break_holder] -->            \/\/calculate the magnitude of the acceleration and print it<!-- [et_pb_line_break_holder] -->            let totalAccel = (x*x + y*y + z*z).squareRoot()<!-- [et_pb_line_break_holder] -->            <!-- [et_pb_line_break_holder] -->            \/\/compare magnitude to threshold<!-- [et_pb_line_break_holder] -->            if(totalAccel > 3.0){<!-- [et_pb_line_break_holder] -->                self.diceLabel.stringValue = \"Shaking\"<!-- [et_pb_line_break_holder] -->            }<!-- [et_pb_line_break_holder] -->            else{<!-- [et_pb_line_break_holder] -->                self.diceLabel.stringValue = \"Not Shaking\"<!-- [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.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;][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;Instructions&#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;]<pee>Run your program. You will see the text <strong>Shaking<\/strong> when you shake your Phidget Accelerometer with enough force.<\/>[\/et_pb_code][\/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;practice&#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;Practice&#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<h2>Practice<\/h2>\n<p><!-- [et_pb_line_break_holder] --><\/p>\n<ol><!-- [et_pb_line_break_holder] --><\/p>\n<li>Modify the threshold value and see how it changes the behavior of your code. For example, if you modify the value from 3.0 to 5.0, what does this mean?<\/li>\n<p><!-- [et_pb_line_break_holder] --><\/p>\n<li>When the user has shaken the &#8220;dice&#8221;, generate a random number between 1 and 6 and print the results to the console.<\/li>\n<p><!-- [et_pb_line_break_holder] --><\/ol>\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; 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;Hint&#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;]<pee><strong>Hint: use the following code to generate a random number.<\/strong><\/pee>[\/et_pb_code][et_pb_code admin_label=&#8221;Code Sample &#8211; Java&#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;]<!-- Dice Roll --><!-- [et_pb_line_break_holder] --><\/p>\n<pre class=\"language-java\"><!-- [et_pb_line_break_holder] -->  <code><!-- [et_pb_line_break_holder] -->\/\/Math.random() generates a random double between 0 and 1<!-- [et_pb_line_break_holder] -->\/\/ Multiple by 5 to get a random number between 0 and 5<!-- [et_pb_line_break_holder] -->\/\/ Add 1 to get a random number between 1 and 6<!-- [et_pb_line_break_holder] -->\/\/Math.round to round the number to a integer<!-- [et_pb_line_break_holder] -->Math.round(Math.random()*5+1);<!-- [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; 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;Hint&#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;]<pee><strong>Hint: use the following code to generate a random number.<\/strong><\/pee>[\/et_pb_code][et_pb_code admin_label=&#8221;Code Sample &#8211; Python&#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;]<!-- Dice Roll --><!-- [et_pb_line_break_holder] --><\/p>\n<pre class=\"language-python\"><!-- [et_pb_line_break_holder] -->  <code><!-- [et_pb_line_break_holder] -->import random<!-- [et_pb_line_break_holder] -->random.randint(1,6)<!-- [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; 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;Hint&#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;]<pee><strong>Hint: use the following code to generate a random number.<\/strong><\/pee>[\/et_pb_code][et_pb_code admin_label=&#8221;Code Sample &#8211; C#&#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;]<!-- Dice Roll --><!-- [et_pb_line_break_holder] --><\/p>\n<pre class=\"language-csharp\"><!-- [et_pb_line_break_holder] -->  <code><!-- [et_pb_line_break_holder] -->Random rnd = new Random();<!-- [et_pb_line_break_holder] -->rnd.Next(1, 6);<!-- [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; 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;Hint&#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;]<pee><strong>Hint: use the following code to generate a random number.<\/strong><\/pee>[\/et_pb_code][et_pb_code admin_label=&#8221;Code Sample &#8211; Swift&#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;]<!-- Dice Roll --><!-- [et_pb_line_break_holder] --><\/p>\n<pre class=\"language-swift\"><!-- [et_pb_line_break_holder] -->  <code><!-- [et_pb_line_break_holder] -->Int.random(in: 1..<7)<!-- [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 admin_label=&#8221;Row&#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; module_id=&#8221;refine&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; disabled=&#8221;on&#8221; disabled_on=&#8221;on|on|on&#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;Refine project&#8221; _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;]<\/p>\n<h2>Refine project<\/h2>\n<p><!-- [et_pb_line_break_holder] --><pee>Here we have provided a list of some popular plants and the lighting level they need to survive.<\/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.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; disabled=&#8221;on&#8221; disabled_on=&#8221;on|on|on&#8221;][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_code admin_label=&#8221;Plant info&#8221; _builder_version=&#8221;4.4.1&#8243; text_orientation=&#8221;center&#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;]<pee>Low light (shade)<!\u2013- [et_pb_br_holder] -\u2013><!-- [et_pb_line_break_holder] -->250 &#8211; 800 lx<!\u2013- [et_pb_br_holder] -\u2013><!-- [et_pb_line_break_holder] -->Snake plant, Fern,<!\u2013- [et_pb_br_holder] -\u2013><!-- [et_pb_line_break_holder] -->ZZ plant<\/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\/plant-monitoring-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_code admin_label=&#8221;Plant info&#8221; _builder_version=&#8221;4.4.1&#8243; text_orientation=&#8221;center&#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;]<pee>Mid light (partial sun)<!\u2013- [et_pb_br_holder] -\u2013><!-- [et_pb_line_break_holder] -->801- 1600 lx<!\u2013- [et_pb_br_holder] -\u2013><!-- [et_pb_line_break_holder] -->Palm, Lipstick Plant, Pothos, Monstera Deliciosa<\/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\/plant-monitoring-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_code admin_label=&#8221;Plant info&#8221; _builder_version=&#8221;4.4.1&#8243; text_orientation=&#8221;center&#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;]<pee>High light (full sun)<!\u2013- [et_pb_br_holder] -\u2013><!-- [et_pb_line_break_holder] -->1601+ lx =<!\u2013- [et_pb_br_holder] -\u2013><!-- [et_pb_line_break_holder] -->Cactus, Fiddle leaf fig, Pilea Peperomioides, String of hearts<\/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\/plant-monitoring-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 admin_label=&#8221;Row&#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; disabled=&#8221;on&#8221; disabled_on=&#8221;on|on|on&#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;Refine project: instructions&#8221; _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;]<pee>Modify your program to use an array to hold these values. Your program should read the illuminance then list the plants that would be suitable for that area. We encourage you to research other plants and their required lighting levels and add them to your array.<\/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.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; module_id=&#8221;expand&#8221; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#8243; disabled=&#8221;on&#8221; disabled_on=&#8221;on|on|on&#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;Expand project&#8221; _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;]<\/p>\n<h2>Expand project<\/h2>\n<p><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Option 1. Get user input to find out what type of plant they have, and then print whether the location is appropriate for that plant.<\/pee><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Option 2. Modify your program to record the illuminance of a location over a period of time and save it in a file. Repeat this for a few days. Read your file and find the average illuminance to determine if the plant will survive in that location. <\/pee><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Option 3. You may find your space is not bright enough for your plant, you can combine your Light Phidget and Power Switch with a fluorescent light to create an artificial environment for your plant. Control when the light is on\/off with your switch and use the Light Phidget to monitor the brightness and ensure the light is is in the appropriate positions relative to your plant.<\/pee>[\/et_pb_code][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner admin_label=&#8221;Row&#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;ph-button-cta: Back to Projects&#8221; _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;]<a class=\"ph-button-cta\" href=\"\/education\/learn\/projects\"><!-- [et_pb_line_break_holder] -->  <\/p>\n<div class=\"ph-button-cta__icon\"><\/div>\n<p><!-- [et_pb_line_break_holder] -->  Back to Projects<!-- [et_pb_line_break_holder] --><\/a>[\/et_pb_code][\/et_pb_column_inner][\/et_pb_row_inner][\/et_pb_column][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\/\/Add Phidgets Libraryimport com.phidget22.*;public class DiceRoll { public static void main(String[] args) throws Exception { \/\/Create Accelerometer accelerometer = new Accelerometer(); \/\/Open accelerometer.open(1000); \/\/Use your Phidgets while (true) { \/\/Get acceleration values double x = accelerometer.getAcceleration()[0]; double y = accelerometer.getAcceleration()[1]; double z = accelerometer.getAcceleration()[2]; \/\/calculate the magnitude of the acceleration and print it double totalAccel [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"parent":842,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_et_pb_use_builder":"on","_et_pb_old_content":"<!-- wp:paragraph -->\r\n<p>This is an example page. It's different from a blog post because it will stay in one place and will show up in your site navigation (in most themes). Most people start with an About page that introduces them to potential site visitors. It might say something like this:<\/p>\r\n<!-- \/wp:paragraph --><!-- wp:quote -->\r\n<blockquote class=\"wp-block-quote\">\r\n<p>Hi there! I'm a bike messenger by day, aspiring actor by night, and this is my website. I live in Los Angeles, have a great dog named Jack, and I like pi\u00f1a coladas. (And gettin' caught in the rain.)<\/p>\r\n<\/blockquote>\r\n<!-- \/wp:quote --><!-- wp:paragraph -->\r\n<p>...or something like this:<\/p>\r\n<!-- \/wp:paragraph --><!-- wp:quote -->\r\n<blockquote class=\"wp-block-quote\">\r\n<p>The XYZ Doohickey Company was founded in 1971, and has been providing quality doohickeys to the public ever since. Located in Gotham City, XYZ employs over 2,000 people and does all kinds of awesome things for the Gotham community.<\/p>\r\n<\/blockquote>\r\n<!-- \/wp:quote --><!-- wp:paragraph -->\r\n<p>As a new WordPress user, you should go to <a href=\"https:\/\/www.phidgets.com\/education\/wp-admin\/\">your dashboard<\/a> to delete this page and create new pages for your content. Have fun!<\/p>\r\n<!-- \/wp:paragraph -->","_et_gb_content_width":"","footnotes":""},"class_list":["post-3949","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.phidgets.com\/education\/wp-json\/wp\/v2\/pages\/3949","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\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.phidgets.com\/education\/wp-json\/wp\/v2\/comments?post=3949"}],"version-history":[{"count":22,"href":"https:\/\/www.phidgets.com\/education\/wp-json\/wp\/v2\/pages\/3949\/revisions"}],"predecessor-version":[{"id":8258,"href":"https:\/\/www.phidgets.com\/education\/wp-json\/wp\/v2\/pages\/3949\/revisions\/8258"}],"up":[{"embeddable":true,"href":"https:\/\/www.phidgets.com\/education\/wp-json\/wp\/v2\/pages\/842"}],"wp:attachment":[{"href":"https:\/\/www.phidgets.com\/education\/wp-json\/wp\/v2\/media?parent=3949"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}