mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-30 16:24:09 +03:00
Run new astyle formatter against all the examples
This commit is contained in:
@ -1,41 +1,41 @@
|
||||
/*
|
||||
Temperature web interface
|
||||
|
||||
This example shows how to serve data from an analog input
|
||||
|
||||
This example shows how to serve data from an analog input
|
||||
via the Arduino Yún's built-in webserver using the Bridge library.
|
||||
|
||||
|
||||
The circuit:
|
||||
* TMP36 temperature sensor on analog pin A1
|
||||
* SD card attached to SD card slot of the Arduino Yún
|
||||
|
||||
Prepare your SD card with an empty folder in the SD root
|
||||
named "arduino" and a subfolder of that named "www".
|
||||
This will ensure that the Yún will create a link
|
||||
|
||||
Prepare your SD card with an empty folder in the SD root
|
||||
named "arduino" and a subfolder of that named "www".
|
||||
This will ensure that the Yún will create a link
|
||||
to the SD to the "/mnt/sd" path.
|
||||
|
||||
In this sketch folder is a basic webpage and a copy of zepto.js, a
|
||||
|
||||
In this sketch folder is a basic webpage and a copy of zepto.js, a
|
||||
minimized version of jQuery. When you upload your sketch, these files
|
||||
will be placed in the /arduino/www/TemperatureWebPanel folder on your SD card.
|
||||
|
||||
|
||||
You can then go to http://arduino.local/sd/TemperatureWebPanel
|
||||
to see the output of this sketch.
|
||||
|
||||
You can remove the SD card while the Linux and the
|
||||
|
||||
You can remove the SD card while the Linux and the
|
||||
sketch are running but be careful not to remove it while
|
||||
the system is writing to it.
|
||||
|
||||
|
||||
created 6 July 2013
|
||||
by Tom Igoe
|
||||
|
||||
|
||||
This example code is in the public domain.
|
||||
|
||||
|
||||
http://arduino.cc/en/Tutorial/TemperatureWebPanel
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include <Bridge.h>
|
||||
#include <YunServer.h>
|
||||
#include <YunClient.h>
|
||||
#include <YunClient.h>
|
||||
|
||||
// Listen on default port 5555, the webserver on the Yun
|
||||
// will forward there all the HTTP requests for us.
|
||||
@ -47,7 +47,7 @@ void setup() {
|
||||
Serial.begin(9600);
|
||||
|
||||
// Bridge startup
|
||||
pinMode(13,OUTPUT);
|
||||
pinMode(13, OUTPUT);
|
||||
digitalWrite(13, LOW);
|
||||
Bridge.begin();
|
||||
digitalWrite(13, HIGH);
|
||||
@ -66,7 +66,7 @@ void setup() {
|
||||
// get the time that this sketch started:
|
||||
Process startTime;
|
||||
startTime.runShellCommand("date");
|
||||
while(startTime.available()) {
|
||||
while (startTime.available()) {
|
||||
char c = startTime.read();
|
||||
startString += c;
|
||||
}
|
||||
@ -89,16 +89,16 @@ void loop() {
|
||||
Process time;
|
||||
time.runShellCommand("date");
|
||||
String timeString = "";
|
||||
while(time.available()) {
|
||||
while (time.available()) {
|
||||
char c = time.read();
|
||||
timeString += c;
|
||||
}
|
||||
Serial.println(timeString);
|
||||
int sensorValue = analogRead(A1);
|
||||
// convert the reading to millivolts:
|
||||
float voltage = sensorValue * (5000/ 1024);
|
||||
float voltage = sensorValue * (5000 / 1024);
|
||||
// convert the millivolts to temperature celsius:
|
||||
float temperature = (voltage - 500)/10;
|
||||
float temperature = (voltage - 500) / 10;
|
||||
// print the temperature:
|
||||
client.print("Current time on the Yún: ");
|
||||
client.println(timeString);
|
||||
|
Reference in New Issue
Block a user