Skip to content

Commit

Permalink
Added #error to printf for examples that require Arduino
Browse files Browse the repository at this point in the history
  • Loading branch information
maniacbug committed Dec 18, 2011
1 parent 19fa395 commit 26ea458
Show file tree
Hide file tree
Showing 10 changed files with 202 additions and 150 deletions.
8 changes: 7 additions & 1 deletion examples/GettingStarted/printf.h
@@ -1,5 +1,5 @@
/*
Copyright (C) 2011 James Coliz, Jr. <maniacbug@ymail.com>
Copyright (C) 2011 J. Coliz <maniacbug@ymail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
Expand All @@ -16,6 +16,8 @@
#ifndef __PRINTF_H__
#define __PRINTF_H__

#ifdef ARDUINO

int serial_putc( char c, FILE * )
{
Serial.write( c );
Expand All @@ -28,4 +30,8 @@ void printf_begin(void)
fdevopen( &serial_putc, 0 );
}

#else
#error This example is only for use on Arduino.
#endif // ARDUINO

#endif // __PRINTF_H__
8 changes: 7 additions & 1 deletion examples/led_remote/printf.h
@@ -1,5 +1,5 @@
/*
Copyright (C) 2011 James Coliz, Jr. <maniacbug@ymail.com>
Copyright (C) 2011 J. Coliz <maniacbug@ymail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
Expand All @@ -16,6 +16,8 @@
#ifndef __PRINTF_H__
#define __PRINTF_H__

#ifdef ARDUINO

int serial_putc( char c, FILE * )
{
Serial.write( c );
Expand All @@ -28,4 +30,8 @@ void printf_begin(void)
fdevopen( &serial_putc, 0 );
}

#else
#error This example is only for use on Arduino.
#endif // ARDUINO

#endif // __PRINTF_H__

0 comments on commit 26ea458

Please sign in to comment.