Permalink
Browse files

Altered debug and casesensitivity toggles to be true false rather tha…

…n commented out.

Makes it a little more clear imo
  • Loading branch information...
1 parent 7603672 commit 8c4efa296493e6ec723086b650f19eabee9b0791 @snargledorf snargledorf committed Jan 23, 2012
Showing with 19 additions and 19 deletions.
  1. +19 −19 RESTduino.ino
View
@@ -18,7 +18,7 @@
*/
-//#define DEBUG 1
+#define DEBUG false
#include <SPI.h>
#include <Ethernet.h>
@@ -39,7 +39,7 @@ Server server(80);
void setup()
{
-#ifdef DEBUG
+#if DEBUG
// turn on serial (for debuggin)
Serial.begin(9600);
#endif
@@ -53,7 +53,7 @@ void setup()
#define BUFSIZE 255
// Toggle case sensitivity
-#define CASESENSE 1
+#define CASESENSE true
void loop()
{
@@ -80,15 +80,15 @@ void loop()
continue;
}
-#ifdef DEBUG
+#if DEBUG
Serial.print("client available bytes before flush: "); Serial.println(client.available());
Serial.print("request = "); Serial.println(clientline);
#endif
// Flush any remaining bytes from the client buffer
client.flush();
-#ifdef DEBUG
+#if DEBUG
// Should be 0
Serial.print("client available bytes after flush: "); Serial.println(client.available());
#endif
@@ -104,7 +104,7 @@ void loop()
urlString = urlString.substring(urlString.indexOf('/'), urlString.indexOf(' ', urlString.indexOf('/')));
// put what's left of the URL back in client line
-#ifdef CASESENSE
+#if CASESENSE
urlString.toUpperCase();
#endif
urlString.toCharArray(clientline, BUFSIZE);
@@ -120,14 +120,14 @@ void loop()
if(pin != NULL){
if(value != NULL){
-#ifdef DEBUG
+#if DEBUG
// set the pin value
Serial.println("setting pin");
#endif
// select the pin
int selectedPin = atoi (pin);
-#ifdef DEBUG
+#if DEBUG
Serial.println(selectedPin);
#endif
@@ -137,20 +137,20 @@ void loop()
// determine digital or analog (PWM)
if(strncmp(value, "HIGH", 4) == 0 || strncmp(value, "LOW", 3) == 0){
-#ifdef DEBUG
+#if DEBUG
// digital
Serial.println("digital");
#endif
if(strncmp(value, "HIGH", 4) == 0){
-#ifdef DEBUG
+#if DEBUG
Serial.println("HIGH");
#endif
digitalWrite(selectedPin, HIGH);
}
if(strncmp(value, "LOW", 3) == 0){
-#ifdef DEBUG
+#if DEBUG
Serial.println("LOW");
#endif
digitalWrite(selectedPin, LOW);
@@ -159,13 +159,13 @@ void loop()
}
else {
-#ifdef DEBUG
+#if DEBUG
// analog
Serial.println("analog");
#endif
// get numeric value
int selectedValue = atoi(value);
-#ifdef DEBUG
+#if DEBUG
Serial.println(selectedValue);
#endif
analogWrite(selectedPin, selectedValue);
@@ -179,7 +179,7 @@ void loop()
}
else {
-#ifdef DEBUG
+#if DEBUG
// read the pin value
Serial.println("reading pin");
#endif
@@ -190,14 +190,14 @@ void loop()
// analog
int selectedPin = pin[1] - '0';
-#ifdef DEBUG
+#if DEBUG
Serial.println(selectedPin);
Serial.println("analog");
#endif
sprintf(outValue,"%d",analogRead(selectedPin));
-#ifdef DEBUG
+#if DEBUG
Serial.println(outValue);
#endif
@@ -207,7 +207,7 @@ void loop()
// digital
int selectedPin = pin[0] - '0';
-#ifdef DEBUG
+#if DEBUG
Serial.println(selectedPin);
Serial.println("digital");
#endif
@@ -225,7 +225,7 @@ void loop()
sprintf(outValue,"%s","HIGH");
}
-#ifdef DEBUG
+#if DEBUG
Serial.println(outValue);
#endif
}
@@ -248,7 +248,7 @@ void loop()
else {
// error
-#ifdef DEBUG
+#if DEBUG
Serial.println("erroring");
#endif
client.println("HTTP/1.1 404 Not Found");

0 comments on commit 8c4efa2

Please sign in to comment.