SHARE
TWEET

Sensor Data To JSON

a guest Sep 27th, 2018 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. //robotzero.one
  3.  
  4. $sensorsData = '{';
  5.  
  6. $sensorsData .= '"peltier":';
  7. $sensorsData .= '{"peltier_temp":';
  8. $sensorsData .= $_GET['peltier_temp'];
  9. $sensorsData .= ',"fan_speed":';
  10. $sensorsData .= $_GET['fan_speed'];
  11. $sensorsData .= '},';
  12.  
  13. $sensorsData .= '"sensor_temp":';
  14. $sensorsData .= '{"air_temp":';
  15. $sensorsData .= $_GET['air_temp'];
  16. $sensorsData .= ',"processed_temp":';
  17. $sensorsData .= $_GET['processed_temp'];
  18. $sensorsData .= '},';
  19.  
  20. $sensorsData .= '"sensor_humidity":';
  21. $sensorsData .= '{"air_humidity":';
  22. $sensorsData .= $_GET['air_humidity'];
  23. $sensorsData .= ',"processed_humidity":';
  24. $sensorsData .= $_GET['processed_humidity'];
  25. $sensorsData .= '}}';
  26.  
  27. file_put_contents('sensordata.txt', $sensorsData);
  28. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top