Skip to content

Commit

Permalink
fixed magic server value (d'oh)
Browse files Browse the repository at this point in the history
  • Loading branch information
5v3n committed Nov 10, 2013
1 parent 0ff1b17 commit 398f761
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
6 changes: 3 additions & 3 deletions arduino/ratpack_yun/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
#define __CONFIG_H__

//comment out to get rid of debug output & the loop waiting for the Serial connection:
#define DEBUG
//#define DEBUG

//io settings
const byte buttonPin = 2; // button pin
const byte ledPin = 9; // signalling led pin
//ratpack server
const char HOST[] = "YOU RATPACK SERVER";
const char HOST[] = "YOUR RATPACK SERVER";

const unsigned long IO_INTERVAL = 0.5*1337; // millisecs delay between updates

#endif
#endif
13 changes: 11 additions & 2 deletions arduino/ratpack_yun/ratpack_yun.ino
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include <Process.h>
#include "Config.h"

char commandBuffer[255]; //it's crude - feel free to handle the commandBuffer length more elegant

void setup() {
// Initialize Bridge
Bridge.begin();
Expand Down Expand Up @@ -46,8 +48,15 @@ void loop() {
}

void receiveState() {
commandBuffer[0] = '\0';
sprintf(commandBuffer, "curl %s/status.json", HOST);

Process p;
p.runShellCommand("curl http://ratpack.makingthingshappen.de/status.json");
p.runShellCommand(commandBuffer);

#ifdef DEBUG
Serial.println(commandBuffer);
#endif

while(p.running()); //wait

Expand Down Expand Up @@ -78,7 +87,7 @@ void sendState(byte state) {
Serial.println((char)state);
#endif

char commandBuffer[255]; //it's crude - feel free to handle the commandBuffer length more elegant
commandBuffer[0] = '\0';
sprintf(commandBuffer, "curl -X PUT -d \"{\\\"activated\\\": %c}\" http://%s/status.json", state, HOST);

#ifdef DEBUG
Expand Down

0 comments on commit 398f761

Please sign in to comment.