Thanks for that.
OK- so I've converted my little sketch to console and the first time around, it showed 'connected' in the serial monitor, but now I'm not often even seeing that.
I'm now wondering if I have my network setup correctly for this console communicating. Because it worked this way for the consoleread example sketch, I'm again thinking that it is fine, but now maybe not.
I read in the consoleread sketch intro that you either telnet to the board or port forward the board and open a serial monitor to connect and see print and other feedback. I port forwarded the board's ip on my lan to 6571 and again, since it worked, I have left it that way, but what is odd to me is that port forwarding is really for outside the lan access to a device on the lan, so this doesn't really make a lot of sense to me because I'm trying to monitor this board's mcu from within my lan. Is there a better way to set this up and/or to open or connect to the console?
Here's my code currently:
// set pin number:
const int buttonPin = 3; // the number of the doorbell input
const int ledPin = 13; // the number of the LED pin
// variables will change:
int buttonState = 0; // variable for reading the pushbutton status
#include <Bridge.h>
#include <Process.h>
#include <Console.h>
void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
Bridge.begin();
Console.begin();
}
void loop() {
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// turn LED on:
digitalWrite(ledPin, HIGH);
runCurl();
delay(750);
} else {
// turn LED off:
digitalWrite(ledPin, LOW);
}
}
void runCurl() {
Process p;
p.begin("/usr/bin/curl");
p.addParameter("-d");
p.addParameter("\"devid=vBECBF1F4A7D765\"");
p.addParameter("http://api.pushingbox.com/pushingbox");
p.run();
while (p.available()>0)
{
char c = p.read();
Console.print(c);
}
}
The led light and button pressing etc all works fine, including the delay, but no serial monitor communication and definitely no success with the runCurl loop.