|
1 |
| - |
2 |
| -// Possible commands are listed here: |
3 |
| -// |
4 |
| -// "digital/13" -> digitalRead(13) |
5 |
| -// "digital/13/1" -> digitalWrite(13, HIGH) |
6 |
| -// "analog/2/123" -> analogWrite(2, 123) |
7 |
| -// "analog/2" -> analogRead(2) |
8 |
| -// "mode/13/input" -> pinMode(13, INPUT) |
9 |
| -// "mode/13/output" -> pinMode(13, OUTPUT) |
| 1 | +/* |
| 2 | + Bridge |
| 3 | + |
| 4 | + This example shows how to use the Bridge library to access the digital |
| 5 | + and analog pins on the board through REST calls. |
| 6 | + It demonstrates how you can create your own API when using REST style |
| 7 | + calls through the browser. |
| 8 | + |
| 9 | + Example of possible commands are listed here: |
| 10 | +
|
| 11 | + "/arduino/digital/13" -> digitalRead(13) |
| 12 | + "/arduino/digital/13/1" -> digitalWrite(13, HIGH) |
| 13 | + "/arduino/analog/2/123" -> analogWrite(2, 123) |
| 14 | + "/arduino/analog/2" -> analogRead(2) |
| 15 | + "/arduino/mode/13/input" -> pinMode(13, INPUT) |
| 16 | + "/arduino/mode/13/output" -> pinMode(13, OUTPUT) |
| 17 | +
|
| 18 | + The circuit: |
| 19 | + there is no need of a particular circuit, you can connect: |
| 20 | + * some analog sensors to the analog inputs |
| 21 | + * LEDs to digital or analog outputs |
| 22 | + * digital sensors such as buttos to the digital inputs |
| 23 | + |
| 24 | + created April 2013 |
| 25 | + by Cristian Maglie |
| 26 | + |
| 27 | + This example code is in the public domain. |
| 28 | + |
| 29 | + */ |
10 | 30 |
|
11 | 31 | #include <Bridge.h>
|
12 | 32 | #include <YunServer.h>
|
|
17 | 37 | YunServer server;
|
18 | 38 |
|
19 | 39 | void setup() {
|
20 |
| - Serial.begin(9600); |
21 |
| - |
22 | 40 | // Bridge startup
|
23 | 41 | pinMode(13,OUTPUT);
|
24 | 42 | digitalWrite(13, LOW);
|
|
0 commit comments