Skip to content

Instantly share code, notes, and snippets.

@n9986
Created May 25, 2012 11:17
Show Gist options
  • Save n9986/2787394 to your computer and use it in GitHub Desktop.
Save n9986/2787394 to your computer and use it in GitHub Desktop.
Simple way to save memory on Serial.print on Arduino
#ifndef __COMMON__
#define __COMMON__
#include "Arduino.h"
//#define DEBUG_ON
#ifdef DEBUG_ON
#define initLog(speed) Serial.begin(speed)
#define log(buf) Serial.print(buf)
#define logLine(buf) Serial.println(buf)
#else
#define initLog(speed)
#define log(buf)
#define logLine(buf)
#endif
#endif // __COMMON__
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment