![Arduino Yun Manual Download Page 21](http://html1.mh-extra.com/html/arduino/yun/yun_manual_2966336021.webp)
Check to make sure the URL is valid
if (client.read() != '/') {
client.println(F("error"));
return;
}
[Get Code]
If it's a valid URL, store the URL as a string. If the mode is an
input
or
output
, configure the
pin and report it to client. If the string doesn't match those values, return an error.
String mode = client.readStringUntil('\r');
if (mode == "input") {
pinMode(pin, INPUT);
// Send feedback to client
client.print(F("Pin D"));
client.print(pin);
client.print(F(" configured as INPUT!"));
return;
}
if (mode == "output") {
pinMode(pin, OUTPUT);
// Send feedback to client
client.print(F("Pin D"));
client.print(pin);
client.print(F(" configured as OUTPUT!"));
return;
}
client.print(F("error: invalid mode "));
client.print(mode);
}
[Get Code]
You can find more details on this example on the
Bridge Example
page.
Connecting to internet services with Temboo