Download Print this page

Arduino Yún Manual page 17

Hello, I am your AI assistant. How can I help you?

Advertisement

// Do nothing here.
}
void runCurl() {
// Launch "curl" command and get Arduino ascii art logo from the network
// curl is command line program for transferring data using different internet protocols
Process p;
// Create a process and call it "p"
p.begin("curl"); // Process that launch the "curl" command
p.addParameter("http://arduino.cc/asciilogo.txt"); // Add the URL parameter to "curl"
p.run();
// Run the process and wait for its termination
// Print arduino logo over the Serial
// A process output can be read with the stream methods
while (p.available()>0) {
char c = p.read();
Serial.print(c);
}
// Ensure the last bit of data is sent.
Serial.flush();
}
[Get Code]
Using Bridge to pass information between processors
Bridge allows you to pass information between the two processors using a key/value pairing.
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 calls through the browser.
When running this example, make sure your computer is on the same network as the Yun.
When you have have programmed the board, you can request the value on a pin, write a value to
a pin, and configure a pin as an input or output.
When the REST password is turned off, you can use a browser with the following URL structure
:
http://myArduinoYun.local/arduino/digital/13
http://myArduinoYun.local/arduino/digital/13/1
http://myArduinoYun.local/arduino/analog/9/123
http://myArduinoYun.local/arduino/analog/2
http://myArduinoYun.local/arduino/mode/13/input
http://myArduinoYun.local/arduino/mode/13/output
You can use the curl command from the command line instead of a browser if you prefer.
You need to include the Bridge, YunServer, and YunClient libraries :
#include <Bridge.h>
#include <YunServer.h>
#include <YunClient.h>
: calls digitalRead(13);
: calls digitalWrite(13,1);
: analogWrite(9,123);
: analogRead(2);
: pinMode(13, INPUT);
: pinMode(13, OUTPUT);

Advertisement

loading
Need help?

Need help?

Do you have a question about the Yún and is the answer not in the manual?

Questions and answers