Analog Sensor Reading


#1

Hi all,

I’m trying to realize a thermometer using the Photon interfaced with ViperApp using a simple analog sensor (AD22100ktz) and I would like to see the temperature on my phone.

I don’t understand how to communicate from Python to Javascript the result of signal elaboration that I have done on main.

These are my “main” and my “template”




 
Someone can help me?
Thank You!!!

#2

you can do it by cloning the “viper app basic” example.
instead of generating a random number in the main.py you stream to the app the “temp” value you calculated.
on the other side you need to update the html label using the already available function “update_label”.

the template.html file you reported has an empty update_label function…

this is the orignal version of template.html edited for your purpose:


   
       
       
       
       
           
   
       

           

Viper Test App


           

                Click me!
               


           

           
Powered by Viper

       

       
   
<p><br></p>