I want to display sensor data on web server. I measure sensor data by arduino and it sends sensor data to raspberry pi via bluetooth(wireless). There are codes for logging data.
code of arduino
#include <SoftwareSerial.h>
#include "HX711.h"
#define calibration_factor -7050.0
#define DAT 5
#define CLK 6
SoftwareSerial bt (2,3);
HX711 scale(DAT,CLK);
void setup(){
bt.begin(9600);
scale.set_scale(calibration_factor);
scale.tare();
}
void loop(){
float h=scale.get_units();
float t=0.454*scale.get_units();
bt.print(String(h) + "," + String(t));
bt.pring("\n");
delay(2000);
}
code of raspberry pi
import bluetooth
bd_addr="xx:xx:xx:xx:xx:xx"
port=1
sock=bluetooth.BluetoothSocket (bluetooth.RFCOMM)
sock.connect((bd_addr.port))
data=""
while 1:
try:
data += sock.recv(1024)
data_end=data.find('\n')
if data_end!=-1:
rec=data[:data_end]
print data
data = data[data_end+1:]
except KeyboardInterrupt:
break
sock.close()
And I compile these codes and I can check sensor data in raspberry pi. How can I display sensor data in web server(LAMP)?