Summary:
In directory: {installdir)/hardware/teensy/cores/teensy3/
comment out lines 87-107 in Print.cpp
comment out lines 98 and 99 in Print.h
paste this code below
#include <stdarg.h>
#define PRINTF_BUF 200 // define the tmp buffer size (change if desired)
int printf(const char *format, ...)
{
char buf[PRINTF_BUF];
va_list ap;
va_start(ap, format);
int n = vsnprintf(buf, sizeof(buf), format, ap);
for (char *p = &buf[0]; *p; p++) // emulate cooked mode for newlines
{
if (*p == '\n')
write('\r');
write(*p);
}
va_end(ap);
return n;
}
#ifdef F // check to see if F() macro is available
int printf(const __FlashStringHelper *format, ...)
{
char buf[PRINTF_BUF];
va_list ap;
va_start(ap, format);
#ifdef __AVR__k
int n = vsnprintf_P(buf, sizeof(buf), (const char *)format, ap); // progmem for AVR
#else
int n = vsnprintf(buf, sizeof(buf), (const char *)format, ap); // for the rest of the world
#endif
for (char *p = &buf[0]; *p; p++) // emulate cooked mode for newlines
{
if (*p == '\n')
write('\r');
write(*p);
}
va_end(ap);
return n;
}
#endif
I don't know an easy way to make this part of our project code
printf doesn't work by default for some reason. You must modify the source code included in the teensy library.
follow instructions here: http://playground.arduino.cc/Main/Printf#sourceblock1
Summary: In directory: {installdir)/hardware/teensy/cores/teensy3/
comment out lines 87-107 in Print.cpp
comment out lines 98 and 99 in Print.h paste this code below
I don't know an easy way to make this part of our project code