Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit 8c4efa296493e6ec723086b650f19eabee9b0791 1 parent 7603672
@snargledorf snargledorf authored
Showing with 19 additions and 19 deletions.
  1. +19 −19 RESTduino.ino
View
38 RESTduino.ino
@@ -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,7 +80,7 @@ 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
@@ -88,7 +88,7 @@ void loop()
// 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");
Please sign in to comment.
Something went wrong with that request. Please try again.