{"id":5692,"date":"2021-06-02T05:03:44","date_gmt":"2021-06-01T22:03:44","guid":{"rendered":"https:\/\/www.phidgets.com\/education\/?page_id=5692"},"modified":"2023-01-10T23:53:15","modified_gmt":"2023-01-10T16:53:15","slug":"pi-website-2","status":"publish","type":"page","link":"https:\/\/www.phidgets.com\/education\/learn\/projects\/pi-website-2\/","title":{"rendered":"Raspberry Pi &#8211; Display Data on Website"},"content":{"rendered":"<p>[et_pb_section fb_built=&#8221;1&#8243; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; custom_padding=&#8221;||0px|&#8221; z_index_tablet=&#8221;0&#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; global_colors_info=&#8221;{}&#8221;][et_pb_row column_structure=&#8221;1_2,1_2&#8243; use_custom_gutter=&#8221;on&#8221; gutter_width=&#8221;3&#8243; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#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; global_colors_info=&#8221;{}&#8221;][et_pb_column type=&#8221;1_2&#8243; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_code admin_label=&#8221;Raspberry Pi &#8211; Display Data on Website&#8221; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#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; global_colors_info=&#8221;{}&#8221;]<\/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>Display Data on Website<!\u2013- [et_pb_br_holder] -\u2013>(Raspberry Pi)<\/h1>\n<p>[\/et_pb_code][et_pb_code admin_label=&#8221;Description&#8221; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#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; global_colors_info=&#8221;{}&#8221;]<pee>In this project, you will improve your previous website and display data from a Humidity Phidget!<\/pee>[\/et_pb_code][et_pb_code admin_label=&#8221;ph-button-cta: Start&#8221; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#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; global_colors_info=&#8221;{}&#8221;]<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; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_image src=&#8221;https:\/\/www.phidgets.com\/education\/wp-content\/uploads\/2021\/06\/pi_website_title2.jpg&#8221; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#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; global_colors_info=&#8221;{}&#8221;][\/et_pb_image][\/et_pb_column][\/et_pb_row][\/et_pb_section][et_pb_section fb_built=&#8221;1&#8243; use_custom_gutter=&#8221;on&#8221; gutter_width=&#8221;3&#8243; specialty=&#8221;on&#8221; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#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; global_colors_info=&#8221;{}&#8221;][et_pb_column type=&#8221;1_4&#8243; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_code admin_label=&#8221;ph-vertical-nav&#8221; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#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; saved_tabs=&#8221;all&#8221; global_colors_info=&#8221;{}&#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=\"#review\" class=\"ph-vertical-nav-item\">Review<\/a><!-- [et_pb_line_break_holder] -->  <a href=\"#display\" class=\"ph-vertical-nav-item\">Displaying Sensor Data<\/a><!-- [et_pb_line_break_holder] -->  <a href=\"#write-code\" class=\"ph-vertical-nav-item\">Create Python Script<\/a><!-- [et_pb_line_break_holder] -->  <a href=\"#modify\" class=\"ph-vertical-nav-item\">Modify Website<\/a><!-- [et_pb_line_break_holder] -->  <a href=\"#next\" 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; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_row_inner module_id=&#8221;setup&#8221; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#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; global_colors_info=&#8221;{}&#8221;][et_pb_column_inner saved_specialty_column_type=&#8221;3_4&#8243; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_code admin_label=&#8221;Setup&#8221; module_id=&#8221;setup&#8221; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#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; global_colors_info=&#8221;{}&#8221;]<\/p>\n<h2>Setup<\/h2>\n<p><!-- [et_pb_line_break_holder] --><pee>Before getting started, make sure you have the following parts.<\/strong><\/pee>[\/et_pb_code][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner column_structure=&#8221;1_3,1_3,1_3&#8243; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; custom_padding=&#8221;||0px|&#8221; z_index_tablet=&#8221;0&#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; global_colors_info=&#8221;{}&#8221;][et_pb_column_inner type=&#8221;1_3&#8243; saved_specialty_column_type=&#8221;3_4&#8243; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_code admin_label=&#8221;Part: GSK&#8221; _builder_version=&#8221;4.18.0&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#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; global_module=&#8221;8489&#8243; saved_tabs=&#8221;all&#8221; global_colors_info=&#8221;{}&#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=\"\">Kit\/<\/a><!-- [et_pb_line_break_holder] -->        <a href=\"\">Getting Started Kit<\/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>Getting Started Kit<\/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\/2022\/08\/KIT4003_2_Square.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; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_code admin_label=&#8221;Part: Pi&#8221; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#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; saved_tabs=&#8221;all&#8221; global_colors_info=&#8221;{}&#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] -->      <\/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>Any Raspberry Pi<\/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\/2021\/03\/pi_logo2.png\"  ><!-- [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; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221;][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner column_structure=&#8221;1_2,1_2&#8243; admin_label=&#8221;Row&#8221; _builder_version=&#8221;4.16&#8243; global_colors_info=&#8221;{}&#8221;][et_pb_column_inner type=&#8221;1_2&#8243; saved_specialty_column_type=&#8221;3_4&#8243; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221;][\/et_pb_column_inner][et_pb_column_inner type=&#8221;1_2&#8243; saved_specialty_column_type=&#8221;3_4&#8243; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221;][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner column_structure=&#8221;1_2,1_2&#8243; admin_label=&#8221;Row&#8221; _builder_version=&#8221;4.16&#8243; global_colors_info=&#8221;{}&#8221;][et_pb_column_inner type=&#8221;1_2&#8243; saved_specialty_column_type=&#8221;3_4&#8243; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_code admin_label=&#8221;Step 1&#8243; _builder_version=&#8221;4.19.2&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; hover_enabled=&#8221;0&#8243; z_index_tablet=&#8221;0&#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; global_colors_info=&#8221;{}&#8221; sticky_enabled=&#8221;0&#8243;]<\/p>\n<h3>Step 1<\/h3>\n<p><!-- [et_pb_line_break_holder] --><pee>Simply connect your Getting Started Kit to your Raspberry Pi. <strong>Note:<\/strong> make sure your Humidity Phidget is connected (not shown in image).<\/pee><!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] --><pee><i>If you haven&#8217;t set up your Raspberry Pi with Phidgets yet, visit <a href=\"\/education\/learn\/projects\/pi-install\/\" target=\"_blank\" rel=\"noopener noreferrer\">this project<\/a>.<\/i><\/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; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_image src=&#8221;https:\/\/www.phidgets.com\/education\/wp-content\/uploads\/2022\/08\/kit4003_2_pi.jpg&#8221; show_in_lightbox=&#8221;on&#8221; _builder_version=&#8221;4.18.0&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#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; global_colors_info=&#8221;{}&#8221;][\/et_pb_image][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner module_id=&#8221;review&#8221; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#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; global_colors_info=&#8221;{}&#8221;][et_pb_column_inner saved_specialty_column_type=&#8221;3_4&#8243; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_code admin_label=&#8221;Review&#8221; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#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; global_colors_info=&#8221;{}&#8221;]<\/p>\n<h2>Review<\/h2>\n<p><!-- [et_pb_line_break_holder] --><pee>In the previous project, you installed a web server on your Raspberry Pi and modified your website. If you have not completed the previous project, <a href=\"\/education\/learn\/projects\/pi-website-1\/\">check it out now<\/a>.<\/pee>[\/et_pb_code][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner module_id=&#8221;display&#8221; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#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; global_colors_info=&#8221;{}&#8221;][et_pb_column_inner saved_specialty_column_type=&#8221;3_4&#8243; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_code admin_label=&#8221;Displaying Sensor Data&#8221; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#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; global_colors_info=&#8221;{}&#8221;]<\/p>\n<h2>Displaying Sensor Data<\/h2>\n<p><!-- [et_pb_line_break_holder] --><pee>There are two ways to display sensor data on your website:<\/pee><!-- [et_pb_line_break_holder] --><\/p>\n<ol><!-- [et_pb_line_break_holder] --><\/p>\n<li>Write a program on your Raspberry Pi that logs sensor data to a file. Open the file from your website and display the data.<\/li>\n<p><!-- [et_pb_line_break_holder] --><\/p>\n<li>Access sensors directly from your web page using the Phidget22 Javascript API.<\/li>\n<p><!-- [et_pb_line_break_holder] --><\/ol>\n<p><!-- [et_pb_line_break_holder] --><pee>For now, we will simply access a data file. Be on the lookout for future projects that use the Javascript API.<\/pee>[\/et_pb_code][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner module_id=&#8221;write-code&#8221; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#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; global_colors_info=&#8221;{}&#8221;][et_pb_column_inner saved_specialty_column_type=&#8221;3_4&#8243; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_code admin_label=&#8221;Write code Python&#8221; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#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; global_colors_info=&#8221;{}&#8221;]<\/p>\n<h2>Write Code<\/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>.<\/pee>[\/et_pb_code][et_pb_code admin_label=&#8221;Code Sample&#8221; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#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; global_colors_info=&#8221;{}&#8221;]<\/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.TemperatureSensor import *<!-- [et_pb_line_break_holder] -->from Phidget22.Devices.DigitalOutput 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] -->temperatureSensor = TemperatureSensor()<!-- [et_pb_line_break_holder] -->statusLED = DigitalOutput()<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->#Address<!-- [et_pb_line_break_holder] -->statusLED.setHubPort(1)<!-- [et_pb_line_break_holder] -->statusLED.setIsHubPortDevice(True)<!-- [et_pb_line_break_holder] --><!-- [et_pb_line_break_holder] -->#Open<!-- [et_pb_line_break_holder] -->temperatureSensor.openWaitForAttachment(1000)<!-- [et_pb_line_break_holder] -->statusLED.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] -->    #Write data to file in CSV format<!-- [et_pb_line_break_holder] -->    with open ('\/var\/www\/html\/data.csv','a') as datafile:<!-- [et_pb_line_break_holder] -->        datafile.write(str(temperatureSensor.getTemperature()) + \"\\n\")    <!-- [et_pb_line_break_holder] -->    #Blink LED<!-- [et_pb_line_break_holder] -->    statusLED.setState(not statusLED.getState())<!-- [et_pb_line_break_holder] -->    <!-- [et_pb_line_break_holder] -->    time.sleep(1.0)<!-- [et_pb_line_break_holder] -->  <\/code><!-- [et_pb_line_break_holder] --><\/pre>\n<p>[\/et_pb_code][et_pb_code admin_label=&#8221;Run Your Program&#8221; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#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; global_colors_info=&#8221;{}&#8221;]<pee>Run your program. You will see the red LED on your Getting Started Kit blink, indicating the program is running.<\/pee>[\/et_pb_code][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner module_id=&#8221;modify&#8221; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#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; global_colors_info=&#8221;{}&#8221;][et_pb_column_inner saved_specialty_column_type=&#8221;3_4&#8243; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_code admin_label=&#8221;Modifying Your Web Page&#8221; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#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; global_colors_info=&#8221;{}&#8221;]<\/p>\n<h2>Modify Your Website<\/h2>\n<p><!-- [et_pb_line_break_holder] --><pee>Overwrite your index.html file with the following:<\/pee>[\/et_pb_code][et_pb_code admin_label=&#8221;Code Sample&#8221; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#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; global_colors_info=&#8221;{}&#8221;]<\/p>\n<pre class=\"language-markup\"><!-- [et_pb_line_break_holder] -->  <code><!-- [et_pb_line_break_holder] -->&lt!doctype html&gt<!-- [et_pb_line_break_holder] -->&lthtml lang=\"en\"&gt<!-- [et_pb_line_break_holder] -->&lthead&gt<!-- [et_pb_line_break_holder] -->    &ltmeta charset=\"utf-8\"&gt<!-- [et_pb_line_break_holder] -->    &lttitle&gtPhidgets&lt\/title&gt<!-- [et_pb_line_break_holder] -->&lt\/head&gt<!-- [et_pb_line_break_holder] -->&ltscript&gt<!-- [et_pb_line_break_holder] -->    function connectPhidgets(){<!-- [et_pb_line_break_holder] -->        fetch('data.csv') <!-- [et_pb_line_break_holder] -->        .then(response =&gt response.text())<!-- [et_pb_line_break_holder] -->        .then(text =&gt {<!-- [et_pb_line_break_holder] -->            var data = text.split(\"\\n\");<!-- [et_pb_line_break_holder] -->            document.getElementById(\"dataLabel\").innerHTML = data[data.length - 2] + \"\u00b0C\";<!-- [et_pb_line_break_holder] -->        })<!-- [et_pb_line_break_holder] -->    }<!-- [et_pb_line_break_holder] -->&lt\/script&gt<!-- [et_pb_line_break_holder] -->    &ltbody onload=\"connectPhidgets()\"&gt<!-- [et_pb_line_break_holder] -->        &ltdiv&gt<!-- [et_pb_line_break_holder] -->            &lth1&gtPhidget Data&lt\/h1&gt<!-- [et_pb_line_break_holder] -->            &lth2 id=\"dataLabel\"&gt?&lt\/h2&gt<!-- [et_pb_line_break_holder] -->        &lt\/div&gt<!-- [et_pb_line_break_holder] -->    &lt\/body&gt<!-- [et_pb_line_break_holder] -->&lt\/html&gt<!-- [et_pb_line_break_holder] -->  <\/code><!-- [et_pb_line_break_holder] --><\/pre>\n<p>[\/et_pb_code][et_pb_code admin_label=&#8221;Modifying Your Web Page&#8221; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#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; global_colors_info=&#8221;{}&#8221;]<pee>JavaScript code has been added to your web page. This code runs in the browser when the website is opened. The function <strong>connectPhidgets<\/strong> will run when the webpage loads. It will grab data from your data file and display the latest reading on your website.<\/pee>[\/et_pb_code][et_pb_image src=&#8221;https:\/\/www.phidgets.com\/education\/wp-content\/uploads\/2021\/06\/pi_website_title2.jpg&#8221; show_in_lightbox=&#8221;on&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; width=&#8221;60%&#8221; z_index_tablet=&#8221;0&#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; global_colors_info=&#8221;{}&#8221;][\/et_pb_image][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner module_id=&#8221;next&#8221; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#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; global_colors_info=&#8221;{}&#8221;][et_pb_column_inner saved_specialty_column_type=&#8221;3_4&#8243; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_code admin_label=&#8221;Practice&#8221; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#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; global_colors_info=&#8221;{}&#8221;]<\/p>\n<h2>Practice<\/h2>\n<p><!-- [et_pb_line_break_holder] --><\/p>\n<ul><!-- [et_pb_line_break_holder] --><\/p>\n<li>Configure your Python file to run on boot. <a href=\"https:\/\/www.phidgets.com\/education\/learn\/projects\/raspberry-pi-automate\" target=\"_blank\" rel=\"noopener noreferrer\">Use this project as a reference<\/a>. <\/li>\n<p><!-- [et_pb_line_break_holder] --><\/p>\n<li>Modify your web page code to continually grab the newest value from your data file.<\/li>\n<p><!-- [et_pb_line_break_holder] --><\/ul>\n<p>[\/et_pb_code][et_pb_video src=&#8221;https:\/\/www.phidgets.com\/education\/wp-content\/uploads\/2021\/06\/website_live.mp4&#8243; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; width=&#8221;75%&#8221; module_alignment=&#8221;center&#8221; z_index_tablet=&#8221;0&#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; global_colors_info=&#8221;{}&#8221;][\/et_pb_video][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner module_id=&#8221;next&#8221; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#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; global_colors_info=&#8221;{}&#8221;][et_pb_column_inner saved_specialty_column_type=&#8221;3_4&#8243; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_code admin_label=&#8221;Next Steps&#8221; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#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; global_colors_info=&#8221;{}&#8221;]<\/p>\n<h2>Next Steps<\/h2>\n<p><!-- [et_pb_line_break_holder] --><pee>When you are comfortable with how the web page works, move on to the continuation of this project: <a href=\"\/education\/learn\/projects\/pi-website-3\/\" target=\"_blank\" rel=\"noopener noreferrer\">Display Graph on Website<\/a><\/pee>[\/et_pb_code][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner disabled_on=&#8221;on|on|on&#8221; module_id=&#8221;troubleshoot&#8221; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#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; disabled=&#8221;on&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_column_inner saved_specialty_column_type=&#8221;3_4&#8243; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_toggle title=&#8221;Troubleshoot&#8221; admin_label=&#8221;Troubleshoot&#8221; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; title_text_shadow_horizontal_length_tablet=&#8221;0px&#8221; title_text_shadow_vertical_length_tablet=&#8221;0px&#8221; title_text_shadow_blur_strength_tablet=&#8221;1px&#8221; closed_title_text_shadow_horizontal_length_tablet=&#8221;0px&#8221; closed_title_text_shadow_vertical_length_tablet=&#8221;0px&#8221; closed_title_text_shadow_blur_strength_tablet=&#8221;1px&#8221; body_text_shadow_horizontal_length_tablet=&#8221;0px&#8221; body_text_shadow_vertical_length_tablet=&#8221;0px&#8221; body_text_shadow_blur_strength_tablet=&#8221;1px&#8221; body_link_text_shadow_horizontal_length_tablet=&#8221;0px&#8221; body_link_text_shadow_vertical_length_tablet=&#8221;0px&#8221; body_link_text_shadow_blur_strength_tablet=&#8221;1px&#8221; body_ul_text_shadow_horizontal_length_tablet=&#8221;0px&#8221; body_ul_text_shadow_vertical_length_tablet=&#8221;0px&#8221; body_ul_text_shadow_blur_strength_tablet=&#8221;1px&#8221; body_ol_text_shadow_horizontal_length_tablet=&#8221;0px&#8221; body_ol_text_shadow_vertical_length_tablet=&#8221;0px&#8221; body_ol_text_shadow_blur_strength_tablet=&#8221;1px&#8221; body_quote_text_shadow_horizontal_length_tablet=&#8221;0px&#8221; body_quote_text_shadow_vertical_length_tablet=&#8221;0px&#8221; body_quote_text_shadow_blur_strength_tablet=&#8221;1px&#8221; box_shadow_horizontal_tablet=&#8221;0px&#8221; box_shadow_vertical_tablet=&#8221;0px&#8221; box_shadow_blur_tablet=&#8221;40px&#8221; box_shadow_spread_tablet=&#8221;0px&#8221; text_shadow_horizontal_length_tablet=&#8221;0px&#8221; text_shadow_vertical_length_tablet=&#8221;0px&#8221; text_shadow_blur_strength_tablet=&#8221;1px&#8221; global_colors_info=&#8221;{}&#8221;]<\/p>\n<ol>\n<li>Make sure everything is plugged in properly and your VINT Hub is connected to your computer<\/li>\n<li>Stop running other programs that are using your Phidgets before running a program.<\/li>\n<\/ol>\n<p>If these do not solve your issue visit the <a target=\"_blank\" rel=\"noopener noreferrer\">Advanced Troubleshooting Page<\/a>.<\/p>\n<p>[\/et_pb_toggle][\/et_pb_column_inner][\/et_pb_row_inner][et_pb_row_inner admin_label=&#8221;Row&#8221; _builder_version=&#8221;4.16&#8243; global_colors_info=&#8221;{}&#8221;][et_pb_column_inner saved_specialty_column_type=&#8221;3_4&#8243; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_code admin_label=&#8221;ph-button-cta: Back to Projects&#8221; _builder_version=&#8221;4.16&#8243; vertical_offset_tablet=&#8221;0&#8243; horizontal_offset_tablet=&#8221;0&#8243; z_index_tablet=&#8221;0&#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; global_colors_info=&#8221;{}&#8221;]<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>&#038;lt!doctype html&#038;gt&#038;lthtml lang=&#8221;en&#8221;&#038;gt&#038;lthead&#038;gt &#038;ltmeta charset=&#8221;utf-8&#8243;&#038;gt &#038;lttitle&#038;gtPhidgets&#038;lt\/title&#038;gt&#038;lt\/head&#038;gt&#038;ltscript&#038;gt function connectPhidgets(){ fetch(&#8216;data.csv&#8217;) .then(response =&#038;gt response.text()) .then(text =&#038;gt { var data = text.split(&#8220;\\n&#8221;); document.getElementById(&#8220;dataLabel&#8221;).innerHTML = data[data.length &#8211; 2] + &#8220;\u00b0C&#8221;; }) }&#038;lt\/script&#038;gt &#038;ltbody onload=&#8221;connectPhidgets()&#8221;&#038;gt &#038;ltdiv&#038;gt &#038;lth1&#038;gtPhidget Data&#038;lt\/h1&#038;gt &#038;lth2 id=&#8221;dataLabel&#8221;&#038;gt?&#038;lt\/h2&#038;gt &#038;lt\/div&#038;gt &#038;lt\/body&#038;gt&#038;lt\/html&#038;gt Make sure everything is plugged in properly and your VINT Hub is connected to your computer Stop running [&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-5692","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.phidgets.com\/education\/wp-json\/wp\/v2\/pages\/5692","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=5692"}],"version-history":[{"count":26,"href":"https:\/\/www.phidgets.com\/education\/wp-json\/wp\/v2\/pages\/5692\/revisions"}],"predecessor-version":[{"id":9373,"href":"https:\/\/www.phidgets.com\/education\/wp-json\/wp\/v2\/pages\/5692\/revisions\/9373"}],"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=5692"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}