mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-16 11:21:18 +03:00
updated Bridge examples headers
This commit is contained in:
@ -1,32 +1,25 @@
|
|||||||
/*
|
/*
|
||||||
Bridge
|
Arduino Yun Bridge example
|
||||||
|
|
||||||
This example shows how to use the Bridge library to access the digital
|
This example for the Arduino Yun shows how to use the
|
||||||
and analog pins on the board through REST calls.
|
Bridge library to access the digital and analog pins
|
||||||
It demonstrates how you can create your own API when using REST style
|
on the board through REST calls. It demonstrates how
|
||||||
|
you can create your own API when using REST style
|
||||||
calls through the browser.
|
calls through the browser.
|
||||||
|
|
||||||
Example of possible commands are listed here:
|
Possible commands created in this shetch:
|
||||||
|
|
||||||
"/arduino/digital/13" -> digitalRead(13)
|
* "digital/13" -> digitalRead(13)
|
||||||
"/arduino/digital/13/1" -> digitalWrite(13, HIGH)
|
* "digital/13/1" -> digitalWrite(13, HIGH)
|
||||||
"/arduino/analog/2/123" -> analogWrite(2, 123)
|
* "analog/2/123" -> analogWrite(2, 123)
|
||||||
"/arduino/analog/2" -> analogRead(2)
|
* "analog/2" -> analogRead(2)
|
||||||
"/arduino/mode/13/input" -> pinMode(13, INPUT)
|
* "mode/13/input" -> pinMode(13, INPUT)
|
||||||
"/arduino/mode/13/output" -> pinMode(13, OUTPUT)
|
* "mode/13/output" -> pinMode(13, OUTPUT)
|
||||||
|
|
||||||
The circuit:
|
|
||||||
there is no need of a particular circuit, you can connect:
|
|
||||||
* some analog sensors to the analog inputs
|
|
||||||
* LEDs to digital or analog outputs
|
|
||||||
* digital sensors such as buttos to the digital inputs
|
|
||||||
|
|
||||||
created April 2013
|
http://arduino.cc/en/Tutorial/Bridge
|
||||||
by Cristian Maglie
|
|
||||||
|
|
||||||
This example code is in the public domain.
|
This example code is part of the public domain
|
||||||
|
*/
|
||||||
*/
|
|
||||||
|
|
||||||
#include <Bridge.h>
|
#include <Bridge.h>
|
||||||
#include <YunServer.h>
|
#include <YunServer.h>
|
||||||
|
@ -10,15 +10,16 @@
|
|||||||
The circuit: No external hardware needed.
|
The circuit: No external hardware needed.
|
||||||
|
|
||||||
created 2006
|
created 2006
|
||||||
by Nicholas Zambetti
|
by Nicholas Zambetti
|
||||||
|
http://www.zambetti.com
|
||||||
modified 9 Apr 2012
|
modified 9 Apr 2012
|
||||||
by Tom Igoe
|
by Tom Igoe
|
||||||
modified 22 May 2013
|
modified 22 May 2013
|
||||||
by Cristian Maglie
|
by Cristian Maglie
|
||||||
|
|
||||||
This example code is in the public domain.
|
This example code is in the public domain.
|
||||||
|
|
||||||
<http://www.zambetti.com>
|
http://arduino.cc/en/Tutorial/ConsoleAsciiTable
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -23,6 +23,8 @@
|
|||||||
|
|
||||||
This example code is in the public domain.
|
This example code is in the public domain.
|
||||||
|
|
||||||
|
http://arduino.cc/en/Tutorial/ConsolePixel
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <Console.h>
|
#include <Console.h>
|
||||||
|
@ -16,6 +16,9 @@
|
|||||||
by Tom Igoe
|
by Tom Igoe
|
||||||
|
|
||||||
This example code is in the public domain.
|
This example code is in the public domain.
|
||||||
|
|
||||||
|
http://arduino.cc/en/Tutorial/ConsoleRead
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <Console.h>
|
#include <Console.h>
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
by Tom Igoe
|
by Tom Igoe
|
||||||
|
|
||||||
This example code is in the public domain.
|
This example code is in the public domain.
|
||||||
|
|
||||||
|
http://arduino.cc/en/Tutorial/YunDatalogger
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
by Cristian Maglie
|
by Cristian Maglie
|
||||||
|
|
||||||
This example code is in the public domain.
|
This example code is in the public domain.
|
||||||
|
|
||||||
|
http://arduino.cc/en/Tutorial/FileWriteScript
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -1,19 +1,47 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
Yun HTTP Client
|
||||||
|
|
||||||
|
This example for the Arduino Yún shows how create a basic
|
||||||
|
HTTP client that connects to the internet and downloads
|
||||||
|
content. In this case, you'll connect to the Arduino
|
||||||
|
website and download a version of the logo as ASCII text.
|
||||||
|
|
||||||
|
created by Tom igoe
|
||||||
|
May 2013
|
||||||
|
|
||||||
|
This example code is in the public domain.
|
||||||
|
|
||||||
|
http://arduino.cc/en/Tutorial/HttpClient
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
#include <Bridge.h>
|
#include <Bridge.h>
|
||||||
#include <HttpClient.h>
|
#include <HttpClient.h>
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
|
// Bridge takes about two seconds to start up
|
||||||
|
// it can be helpful to use the on-board LED
|
||||||
|
// as an indicator for when it has initialized
|
||||||
pinMode(13, OUTPUT);
|
pinMode(13, OUTPUT);
|
||||||
digitalWrite(13, LOW);
|
digitalWrite(13, LOW);
|
||||||
Bridge.begin();
|
Bridge.begin();
|
||||||
|
digitalWrite(13, HIGH);
|
||||||
|
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
while(!Serial);
|
|
||||||
|
while(!Serial); // wait for a serial connection
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
// Initialize the client library
|
||||||
HttpClient client;
|
HttpClient client;
|
||||||
|
|
||||||
|
// Make a HTTP request:
|
||||||
client.get("http://arduino.cc/asciilogo.txt");
|
client.get("http://arduino.cc/asciilogo.txt");
|
||||||
|
|
||||||
|
// if there are incoming bytes available
|
||||||
|
// from the server, read them and print them:
|
||||||
while (client.available()) {
|
while (client.available()) {
|
||||||
char c = client.read();
|
char c = client.read();
|
||||||
Serial.print(c);
|
Serial.print(c);
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
by Cristian Maglie
|
by Cristian Maglie
|
||||||
|
|
||||||
This example code is in the public domain.
|
This example code is in the public domain.
|
||||||
|
|
||||||
|
http://arduino.cc/en/Tutorial/Process
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
This example code is in the public domain.
|
This example code is in the public domain.
|
||||||
|
|
||||||
|
http://arduino.cc/en/Tutorial/ShellCommands
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <Process.h>
|
#include <Process.h>
|
||||||
|
@ -27,10 +27,12 @@
|
|||||||
created 6 July 2013
|
created 6 July 2013
|
||||||
by Tom Igoe
|
by Tom Igoe
|
||||||
|
|
||||||
|
|
||||||
This example code is in the public domain.
|
This example code is in the public domain.
|
||||||
|
|
||||||
|
http://arduino.cc/en/Tutorial/TemperatureWebPanel
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <Bridge.h>
|
#include <Bridge.h>
|
||||||
#include <YunServer.h>
|
#include <YunServer.h>
|
||||||
#include <YunClient.h>
|
#include <YunClient.h>
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
By Tom Igoe
|
By Tom Igoe
|
||||||
|
|
||||||
This example code is in the public domain.
|
This example code is in the public domain.
|
||||||
|
|
||||||
|
http://arduino.cc/en/Tutorial/TimeCheck
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -14,7 +14,10 @@
|
|||||||
By Federico Fissore
|
By Federico Fissore
|
||||||
|
|
||||||
This example code is in the public domain.
|
This example code is in the public domain.
|
||||||
*/
|
|
||||||
|
http://arduino.cc/en/Tutorial/YunWiFiStatus
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
#include <Process.h>
|
#include <Process.h>
|
||||||
|
|
||||||
|
@ -7,9 +7,12 @@
|
|||||||
created 15 March 2010
|
created 15 March 2010
|
||||||
updated 27 May 2013
|
updated 27 May 2013
|
||||||
by Tom Igoe
|
by Tom Igoe
|
||||||
|
|
||||||
|
http://arduino.cc/en/Tutorial/YunXivelyClient
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// include all Libraries needed:
|
// include all Libraries needed:
|
||||||
#include <Process.h>
|
#include <Process.h>
|
||||||
#include "passwords.h" // contains my passwords, see below
|
#include "passwords.h" // contains my passwords, see below
|
||||||
|
@ -27,8 +27,12 @@
|
|||||||
modified by Cristian Maglie
|
modified by Cristian Maglie
|
||||||
|
|
||||||
This example code is in the public domain.
|
This example code is in the public domain.
|
||||||
|
|
||||||
|
http://arduino.cc/en/Tutorial/YunSerialTerminal
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
long lininoBaud = 250000;
|
long lininoBaud = 250000;
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
@ -75,4 +79,4 @@ void loop() {
|
|||||||
char c = (char)Serial1.read(); // read from Linino
|
char c = (char)Serial1.read(); // read from Linino
|
||||||
Serial.write(c); // write to USB-serial
|
Serial.write(c); // write to USB-serial
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user