Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Corrected _DEBUG to DEBUG, misc changes to README

  • Loading branch information...
commit ae0f9b3e40162efe3ec4942dd358c4b9d8cd7d89 1 parent 4be7930
@Hardcore-fs Hardcore-fs authored
View
39 TinyWebServer.cpp
@@ -6,15 +6,20 @@
// Updated: 08-JAN-2012 for Arduno IDE 1.0 by <Hardcore@hardcoreforensics.com>
//
// TinyWebServer for Arduino.
+//
+// The DEBUG flag will enable serial console logging in this library
+// By default Debugging to the Serial console is OFF.
+// This ensures that any scripts using the Serial port are not corrupted
+// by the tinywebserver libraries debugging messages.
+//
+// To ENABLE debugging set the following:
+// DEBUG 1 and ENSURE that you have configured the serial port in the
+// main Arduino script.
+//
+// There is an overall size increase of about 340 bytes in code size
+// when the debugging is enabled and debugging lines are preceded by 'TWS:'
-// The _DEBUG flag will enable serial console logging in this library
-// By default it is OFF, to ensure that any scripts using the Serial port
-// are not corrupted by this libraries debugging messages.
-// To Enable debugging set the following: _DEBUG 1 and
-// ENSURE that you have configured the serial port in the main Arduino script.
-// Overall size increase in the code for debugging is about 330 bytes.
-
-#define _DEBUG 0
+#define DEBUG 0
#include "Arduino.h"
@@ -52,9 +57,9 @@ FLASH_STRING(mime_types,
void *malloc_check(size_t size) {
void* r = malloc(size);
-#if _DEBUG
+#if DEBUG
if (!r) {
- Serial << F("No space for malloc: " ); Serial.println(size, DEC);
+ Serial << F("TWS:No space for malloc: " ); Serial.println(size, DEC);
}
#endif
return r;
@@ -124,7 +129,7 @@ boolean TinyWebServer::process_headers() {
if (!read_next_char(client_, (uint8_t*)&ch)) {
continue;
}
-#if _DEBUG
+#if DEBUG
Serial.print(ch);
#endif
switch (state) {
@@ -224,8 +229,8 @@ void TinyWebServer::process() {
if (!buffer[0]) {
return;
}
-#if _DEBUG
- Serial << F("New request: ");
+#if DEBUG
+ Serial << F("TWS:New request: ");
Serial.println(buffer);
#endif
if (!is_complete) {
@@ -322,8 +327,8 @@ boolean TinyWebServer::assign_header_value(const char* header, char* value) {
FLASH_STRING(content_type_msg, "Content-Type: ");
void TinyWebServer::send_error_code(Client& client, int code) {
-#if _DEBUG
- Serial << F("Returning ");
+#if DEBUG
+ Serial << F("TWS:Returning ");
Serial.println(code, DEC);
#endif
client << F("HTTP/1.1 ");
@@ -615,8 +620,8 @@ boolean put_handler(TinyWebServer& web_server) {
if (millis() - start_time > 30000) {
// Exit if there has been zero data from connected client
// for more than 30 seconds.
-#if _DEBUG
- Serial << F("There has been no data for >30 Sec.\n");
+#if DEBUG
+ Serial << F("TWS:There has been no data for >30 Sec.\n");
#endif
break;
}
View
11 examples/BlinkLed/README.txt
@@ -1,11 +1,14 @@
To get this example running, make sure you modify the IP address
-inside the BlinkLed.pde and upload.sh files to match an unused IP
+inside the BlinkLed.ino and upload.sh files to match an unused IP
address in your network.
-Connect an LED with a resistor to pin 7 of your Arduino (the +
-terminal of the LED should be on Pin 7). Connect LED's GND to a ground
-pin on your Arduino. See the video below for how it works:
+Connect an LED with a series resistor between pin 7 and Gnd of
+your Arduino.
+Connect LED's GND to a Gnd pin on your Arduino, the other terminal
+ of the LED via the resistor should be on Pin 7.
+
+See the video below for how it works:
http://www.youtube.com/watch?v=qZXKk6nCYuM
Then run the upload.sh script to upload the files in the static
View
2  examples/FileUpload/README.txt
@@ -1,5 +1,5 @@
To get this example running, make sure you modify the IP address
-inside the FileUpload.pde and upload.sh files to match an unused IP
+inside the FileUpload.ino and upload.sh files to match an unused IP
address in your network.
Then run the upload.sh script to upload the files in the static
Please sign in to comment.
Something went wrong with that request. Please try again.