{"id":1274,"date":"2020-04-14T18:42:42","date_gmt":"2020-04-14T11:42:42","guid":{"rendered":"https:\/\/www.phidgets.com\/educationDEV\/?page_id=1274"},"modified":"2022-06-01T03:57:07","modified_gmt":"2022-05-31T20:57:07","slug":"tank-level-monitoring","status":"publish","type":"page","link":"https:\/\/www.phidgets.com\/education\/learn\/projects\/tank-level-monitoring\/","title":{"rendered":"Phidgets Projects &#8211; Tank level monitoring"},"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;Tank level monitoring&#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>Tank Level Monitoring<\/h1>\n<p>[\/et_pb_code][et_pb_code admin_label=&#8221;Description&#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>Whether in food production or fuel\/water usage, its good to know the volume of a liquid is in a tank.  You may be surprised to learn you can do this with a Sonar Phidget! By mounting the sensor looking into the top of the tank, you can measure the distance to the tank&#8217;s contents. If you know the dimension of the tank, you can calculate the volume.<\/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.4.1&#8243; src=&#8221;https:\/\/www.phidgets.com\/education\/wp-content\/uploads\/2020\/04\/tank-level-monitoring-1.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.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; 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.<\/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: sonar&#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=\"\">Sensors \/<\/a><!-- [et_pb_line_break_holder] -->        <a href=\"\">dst1200<\/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>Sonar 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\/04\/part-sonar.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: 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_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_code admin_label=&#8221;Part: container&#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\">\u00a0<\/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>Container *<\/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-container-scaled.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: 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_code admin_label=&#8221;Part: rice&#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\">\u00a0<\/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>Rice **<\/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-rice-scaled.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 _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;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;Note&#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><strong>NOTE:<\/strong><!\u2013- [et_pb_br_holder] -\u2013><!-- [et_pb_line_break_holder] -->* Depending on the size of your container you may meed some cardboard\/tape to secure the Sonar Phidget.<!\u2013- [et_pb_br_holder] -\u2013><!-- [et_pb_line_break_holder] -->** Rice is easier to use than a liquid in the classroom because you do not need to worry about the Phidget or computers getting wet<!-- [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;][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.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>Step 1<\/h3>\n<p><!-- [et_pb_line_break_holder] --><pee>Attach the Sonar Phidget to the VINT Hub and the 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.4.3&#8243; src=&#8221;https:\/\/www.phidgets.com\/education\/wp-content\/uploads\/2020\/04\/connect-sonar-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; show_in_lightbox=&#8221;on&#8221; \/][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner admin_label=&#8221;Row&#8221; _builder_version=&#8221;4.4.1&#8243;][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 2&#8243; _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>Step 2<\/h3>\n<p><!-- [et_pb_line_break_holder] --><pee>Cut a hole in cardboard big enough so the full sensor is exposed, and attach to the sensor.<\/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.4.3&#8243; src=&#8221;https:\/\/www.phidgets.com\/education\/wp-content\/uploads\/2020\/04\/tank-level-monitoring-2-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; show_in_lightbox=&#8221;on&#8221; \/][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner admin_label=&#8221;Row&#8221; _builder_version=&#8221;4.4.1&#8243;][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 3&#8243; _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<h3>Step 3<\/h3>\n<p><!-- [et_pb_line_break_holder] --><pee>Place the sensor on top of container (do not secure the cardboard as it needs to be mobile so you can add rice to the container)<\/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.4.3&#8243; src=&#8221;https:\/\/www.phidgets.com\/education\/wp-content\/uploads\/2020\/04\/tank-level-monitoring-3-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; 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;][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.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-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.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<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> Insert the code below.<!\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.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-eclipse&#8221;]<!-- Tank level monitoring --><!-- [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 TankLevel {<!-- [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] -->        DistanceSensor distanceSensor = new DistanceSensor();<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->        \/\/Open<!-- [et_pb_line_break_holder] -->        distanceSensor.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(\"Distance: \" + distanceSensor.getDistance() + \" mm\");<!-- [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.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-netbeans&#8221;]<!-- Tank level monitoring --><!-- [et_pb_line_break_holder] --><\/p>\n<pre class=\"language-java\"><!-- [et_pb_line_break_holder] -->  <code><!-- [et_pb_line_break_holder] -->package tanklevel;<!-- [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 TankLevel {<!-- [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] -->        DistanceSensor distanceSensor = new DistanceSensor();<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->        \/\/Open<!-- [et_pb_line_break_holder] -->        distanceSensor.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(\"Distance: \" + distanceSensor.getDistance() + \" mm\");<!-- [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.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-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.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<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> Insert the code below.<!\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.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;]<!-- Tank level monitoring --><!-- [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.DistanceSensor 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] -->distanceSensor = DistanceSensor()<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->#Open<!-- [et_pb_line_break_holder] -->distanceSensor.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(\"Distance: \" + str(distanceSensor.getDistance()) + \" mm\")<!-- [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.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<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> Insert the code below.<!\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.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;]<!-- Tank level monitoring --><!-- [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 TankLevel{<!-- [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] -->            DistanceSensor distanceSensor = new DistanceSensor();<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->            \/\/Open<!-- [et_pb_line_break_holder] -->            distanceSensor.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.Console.WriteLine(\"Distance: \" + distanceSensor.Distance + \" mm\");<!-- [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.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<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> Insert the code below.<!\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.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;]<!-- Tank level 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] -->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 distanceLabel: NSTextField!<!-- [et_pb_line_break_holder] -->    <!-- [et_pb_line_break_holder] -->    \/\/Create<!-- [et_pb_line_break_holder] -->    let distanceSensor = DistanceSensor()<!-- [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 _ = distanceSensor.distanceChange.addHandler(distance_change)<!-- [et_pb_line_break_holder] -->            <!-- [et_pb_line_break_holder] -->            \/\/Open<!-- [et_pb_line_break_holder] -->            try distanceSensor.open()<!-- [et_pb_line_break_holder] -->            <!-- [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 distance_change(sender:DistanceSensor, distance: UInt32) {<!-- [et_pb_line_break_holder] -->      DispatchQueue.main.async {<!-- [et_pb_line_break_holder] -->        \/\/ Use information from your Phidget to change label<!-- [et_pb_line_break_holder] -->        self.distanceLabel.stringValue = String(distance) + \" mm\"<!-- [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.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;]<pee>Try running your program. You will see the distance from the sensor to the top of the &#8220;liquid&#8221; printed.<\/pee>[\/et_pb_code][et_pb_image _builder_version=&#8221;4.4.3&#8243; src=&#8221;https:\/\/www.phidgets.com\/education\/wp-content\/uploads\/2020\/04\/tank-level-monitoring-4-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; show_in_lightbox=&#8221;on&#8221; align=&#8221;center&#8221; width=&#8221;70%&#8221; \/][\/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.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<h2>Practice<\/h2>\n<p><!-- [et_pb_line_break_holder] --><\/p>\n<ol><!-- [et_pb_line_break_holder] -->    <\/p>\n<li>Modify the code to print the height of the &#8220;liquid&#8221; (rice) in the container.<\/li>\n<p><!-- [et_pb_line_break_holder] -->    <\/p>\n<li>Create alerts if the levels approach the top of the container and when the levels are nearing empty.<\/li>\n<p><!-- [et_pb_line_break_holder] --><\/ol>\n<p>[\/et_pb_code][et_pb_image _builder_version=&#8221;4.4.3&#8243; src=&#8221;https:\/\/www.phidgets.com\/education\/wp-content\/uploads\/2020\/04\/tank-level-monitoring-5-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; show_in_lightbox=&#8221;on&#8221; align=&#8221;center&#8221; width=&#8221;70%&#8221; \/][\/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>Find the volume of liquid or rice in your container. To do this you have to do some simple math.<\/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_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;Container type&#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>Cylindrical container:<\/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\/tank-level-monitoring-6.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_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;Container type&#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>Rectangular container:<\/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\/tank-level-monitoring-7.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; 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. Use LEDs in your Getting Started kit to alert when container approaching empty (red) or full (green).<\/pee><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee>Option 2. Send text updates if volume changes (You can decide what interval updates should be sent i.e. snd update with every 2 cm change)<\/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 TankLevel { public static void main(String[] args) throws Exception { \/\/Create DistanceSensor distanceSensor = new DistanceSensor(); \/\/Open distanceSensor.open(1000); \/\/Use your Phidgets while (true) { System.out.println(&#8220;Distance: &#8221; + distanceSensor.getDistance() + &#8221; mm&#8221;); Thread.sleep(150); } }} package tanklevel;\/\/Add Phidgets Libraryimport com.phidget22.*;public class TankLevel { public static void main(String[] args) throws Exception { [&hellip;]<\/p>\n","protected":false},"author":1,"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-1274","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.phidgets.com\/education\/wp-json\/wp\/v2\/pages\/1274","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=1274"}],"version-history":[{"count":17,"href":"https:\/\/www.phidgets.com\/education\/wp-json\/wp\/v2\/pages\/1274\/revisions"}],"predecessor-version":[{"id":8268,"href":"https:\/\/www.phidgets.com\/education\/wp-json\/wp\/v2\/pages\/1274\/revisions\/8268"}],"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=1274"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}