Hardware Reference
In-Depth Information
pclose
This function from the C library is available within Galileo to close a stream
opened by
popen
. See
Example 6-3
for more information.
Syntax
pclose(fp);
Parameters
fp
File pointer from a
popen
stream.
Return value
0 if no error.
Example
int getHours() {
char output[5];
FILE *fp;
fp = popen("curl http://nextmakemagazine.appspot.com/simple", "r");
if (fp == NULL) {
Serial.println("Couldn't run the curl command.");
return -1;
}
else {
fgets(output, sizeof(output), fp);
}
if (pclose(fp) != 0) {
Serial.println("The curl command returned an error.");
return -1;
}
return atoi(output);
}
pinMode
Sets the direction (or mode) of a digital pin to input or output. See
“pin-
Mode()” on page 37
.
Syntax
pinMode(pin, mode);
Parameters
pin
The pin number
mode
Either INPUT or OUTPUT (case-sensitive)