The below code send some data (temperature and pressure here) to a server and reads back some data from server. The send part works every 5 minutes and the read part works every 5 seconds. This code works by polling method. All delays might have room for optimization #include <SFE_BMP180.h> //from sparkfun #include <Wire.h> #include… Continue reading Arduino – Communicate With Server – Part 1 – Arduino code
Author: Manish
PHP Socket Client
This is a simple client that is running two different requests. One at every 2 seconds and another every 5 minutes. The 2 second one retrieved data from server and the 5 minute one sends data to server. <?php set_time_limit(0); ob_implicit_flush(); $host = “xxx.xxx.xxx.xxx”; $port = 1250; $lastUpdate = time(); while(1) { if(time() -… Continue reading PHP Socket Client
PHP Socket Server – Running as Daemon and Multiple Connections
Code Courtesy: lars at opdenkamp dot eu A socket server written in PHP. This can accept multiple connections and runs as a daemon. pcntl_fork() is thing here that is making this all possible. <?php /** * Listens for requests and forks on each connection */ $__server_listening = true; //error_reporting(E_ALL); set_time_limit(0); ob_implicit_flush(); declare(ticks = 1); become_daemon();… Continue reading PHP Socket Server – Running as Daemon and Multiple Connections
BMP-180 Digital Barometric Pressure Sensor
BMP-180 is a compact and cheap Digital Barometric Pressure Sensor. Below is an image of the breakout board commonly available on ebay There is some confusing information about the required voltage, so safest would be to go with 3.3v. As per datasheet (download here) from Bosch, the chip manufacturer, the max voltage is 3.6v It… Continue reading BMP-180 Digital Barometric Pressure Sensor
Realtime Charts / Graphs
CanvasJS provides a very developer friendly chat or graph library. The library is based on HTML 5 and JS. And can also be used for displaying realtime charts or graphs also. There are various types of charts/graphs available. Below are some useful codes Frontend code: <?php $conn = mysql_connect(“localhost”,”xxxxxxxxx”,”xxxxxxxxx”); if(!$conn) { echo “Error: failed… Continue reading Realtime Charts / Graphs