mirror of
https://github.com/arduino/Arduino.git
synced 2024-11-29 10:24:12 +01:00
updated Bridge examples headers
This commit is contained in:
parent
421fa18c3c
commit
3e2008dfcc
@ -1,32 +1,25 @@
|
||||
/*
|
||||
Bridge
|
||||
Arduino Yun Bridge example
|
||||
|
||||
This example shows how to use the Bridge library to access the digital
|
||||
and analog pins on the board through REST calls.
|
||||
It demonstrates how you can create your own API when using REST style
|
||||
This example for the Arduino Yun shows how to use the
|
||||
Bridge library to access the digital and analog pins
|
||||
on the board through REST calls. It demonstrates how
|
||||
you can create your own API when using REST style
|
||||
calls through the browser.
|
||||
|
||||
Example of possible commands are listed here:
|
||||
Possible commands created in this shetch:
|
||||
|
||||
"/arduino/digital/13" -> digitalRead(13)
|
||||
"/arduino/digital/13/1" -> digitalWrite(13, HIGH)
|
||||
"/arduino/analog/2/123" -> analogWrite(2, 123)
|
||||
"/arduino/analog/2" -> analogRead(2)
|
||||
"/arduino/mode/13/input" -> pinMode(13, INPUT)
|
||||
"/arduino/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
|
||||
* "digital/13" -> digitalRead(13)
|
||||
* "digital/13/1" -> digitalWrite(13, HIGH)
|
||||
* "analog/2/123" -> analogWrite(2, 123)
|
||||
* "analog/2" -> analogRead(2)
|
||||
* "mode/13/input" -> pinMode(13, INPUT)
|
||||
* "mode/13/output" -> pinMode(13, OUTPUT)
|
||||
|
||||
created April 2013
|
||||
by Cristian Maglie
|
||||
http://arduino.cc/en/Tutorial/Bridge
|
||||
|
||||
This example code is in the public domain.
|
||||
|
||||
*/
|
||||
This example code is part of the public domain
|
||||
*/
|
||||
|
||||
#include <Bridge.h>
|
||||
#include <YunServer.h>
|
||||
|
@ -10,15 +10,16 @@
|
||||
The circuit: No external hardware needed.
|
||||
|
||||
created 2006
|
||||
by Nicholas Zambetti
|
||||
by Nicholas Zambetti
|
||||
http://www.zambetti.com
|
||||
modified 9 Apr 2012
|
||||
by Tom Igoe
|
||||
modified 22 May 2013
|
||||
by Cristian Maglie
|
||||
|
||||
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.
|
||||
|
||||
http://arduino.cc/en/Tutorial/ConsolePixel
|
||||
|
||||
*/
|
||||
|
||||
#include <Console.h>
|
||||
|
@ -16,6 +16,9 @@
|
||||
by Tom Igoe
|
||||
|
||||
This example code is in the public domain.
|
||||
|
||||
http://arduino.cc/en/Tutorial/ConsoleRead
|
||||
|
||||
*/
|
||||
|
||||
#include <Console.h>
|
||||
|
@ -25,6 +25,8 @@
|
||||
by Tom Igoe
|
||||
|
||||
This example code is in the public domain.
|
||||
|
||||
http://arduino.cc/en/Tutorial/YunDatalogger
|
||||
|
||||
*/
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
by Cristian Maglie
|
||||
|
||||
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 <HttpClient.h>
|
||||
|
||||
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);
|
||||
digitalWrite(13, LOW);
|
||||
Bridge.begin();
|
||||
digitalWrite(13, HIGH);
|
||||
|
||||
Serial.begin(9600);
|
||||
while(!Serial);
|
||||
|
||||
while(!Serial); // wait for a serial connection
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// Initialize the client library
|
||||
HttpClient client;
|
||||
|
||||
// Make a HTTP request:
|
||||
client.get("http://arduino.cc/asciilogo.txt");
|
||||
|
||||
// if there are incoming bytes available
|
||||
// from the server, read them and print them:
|
||||
while (client.available()) {
|
||||
char c = client.read();
|
||||
Serial.print(c);
|
||||
|
@ -8,6 +8,8 @@
|
||||
by Cristian Maglie
|
||||
|
||||
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.
|
||||
|
||||
http://arduino.cc/en/Tutorial/ShellCommands
|
||||
|
||||
*/
|
||||
|
||||
#include <Process.h>
|
||||
|
@ -27,10 +27,12 @@
|
||||
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>
|
||||
|
@ -11,6 +11,8 @@
|
||||
By Tom Igoe
|
||||
|
||||
This example code is in the public domain.
|
||||
|
||||
http://arduino.cc/en/Tutorial/TimeCheck
|
||||
|
||||
*/
|
||||
|
||||
|
@ -14,7 +14,10 @@
|
||||
By Federico Fissore
|
||||
|
||||
This example code is in the public domain.
|
||||
*/
|
||||
|
||||
http://arduino.cc/en/Tutorial/YunWiFiStatus
|
||||
|
||||
*/
|
||||
|
||||
#include <Process.h>
|
||||
|
||||
|
@ -7,9 +7,12 @@
|
||||
created 15 March 2010
|
||||
updated 27 May 2013
|
||||
by Tom Igoe
|
||||
|
||||
http://arduino.cc/en/Tutorial/YunXivelyClient
|
||||
|
||||
*/
|
||||
|
||||
|
||||
// include all Libraries needed:
|
||||
#include <Process.h>
|
||||
#include "passwords.h" // contains my passwords, see below
|
||||
|
@ -27,8 +27,12 @@
|
||||
modified by Cristian Maglie
|
||||
|
||||
This example code is in the public domain.
|
||||
|
||||
http://arduino.cc/en/Tutorial/YunSerialTerminal
|
||||
|
||||
*/
|
||||
|
||||
|
||||
long lininoBaud = 250000;
|
||||
|
||||
void setup() {
|
||||
@ -75,4 +79,4 @@ void loop() {
|
||||
char c = (char)Serial1.read(); // read from Linino
|
||||
Serial.write(c); // write to USB-serial
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user