mrteo
Posts: 9
Joined: Thu Oct 01, 2015 5:30 am

Posting a data on a Html page

Sat Oct 10, 2015 6:51 am

Good day,

Currently, I have a Raspberry Pi that collects data wireless-ly from different sensors in a room, as for now, the Raspberry Pi is program to continuously receive the current of the different lighting and is displayed into an Apache sever, so that means the Raspberry Pi is continuously receiving the numbers (450~530) as indication of the current of the different lightings and is displayed in an Apache sever as txt form. Is it possible to instead display "Healthy" or "Non-Healthy" instead of the numbers? As I am creating a website that monitors that allow users to monitor the data from the different sensors. I want the data display easy to understand on the website.
Thank you :)

Image

User avatar
Laurens-wuyts
Posts: 716
Joined: Wed Aug 21, 2013 7:35 pm
Location: Belgium
Contact: Website

Re: Posting a data on a Html page

Sat Oct 10, 2015 9:41 am

For doing that, you'll need some php script to run and process the data. ;)

Laurens

mrteo
Posts: 9
Joined: Thu Oct 01, 2015 5:30 am

Re: Posting a data on a Html page

Sat Oct 10, 2015 3:54 pm

Laurens-wuyts wrote:For doing that, you'll need some php script to run and process the data. ;)

Laurens

Processing of data .. hmm interesting, thank you for your assistance and have a great day ahead !

enedil
Posts: 66
Joined: Sat Feb 21, 2015 4:22 pm
Location: Toruń, Poland
Contact: Website

Re: Posting a data on a Html page

Sat Oct 10, 2015 7:11 pm

I would set up a Ruby Sinatra or NodeJS micro-service, that posts the data in processed form.
How do you collect the data?
Which programming language?
- What Can a Thoughtful Man Hope for Mankind on Earth, Given the Experience of the Past Million Years?
- Nothing.

Kurt Vonnegut, Cat's Cradle

stderr
Posts: 2178
Joined: Sat Dec 01, 2012 11:29 pm

Re: Posting a data on a Html page

Tue Nov 03, 2015 4:25 am

mrteo wrote: Is it possible to instead display "Healthy" or "Non-Healthy" instead of the numbers?
You can regularly rebuild your html page using some sort of library that spits out html, e.g. Scala's scalatags, http://lihaoyi.github.io/scalatags/#GettingStarted , although there must be something similar for other languages.

As long as you make sure you aren't serving up a cached version of the page or using your local browser cached copy or something like that. You could include in your page a javascript bit that regularly refreshes it.

This approach is different from the usual CGI one, so I thought I'd just toss it out.

jwenting
Posts: 11
Joined: Thu Oct 29, 2015 10:38 am

Re: Posting a data on a Html page

Tue Nov 03, 2015 7:10 am

I'd use Spring Boot with some Groovy or Java and an html template. But it's really all up to you.
What do you know, what do you want to learn, what are you comfortable using.

Return to “Other programming languages”