Re: avr-gcc making really bad inlining decisions.

Bill Westfield <[email protected]>
Newsgroups gmane.comp.hardware.avr.gcc
Message-ID <CAPmNOeB428VNrACkGw57HsBs77+V=PYx9iHdu6PybK1=B9_SbA@mail.gmail.com>
Here is the pre-processed file, so y'all don't have to mess with
arduino "stuff."
The suspect compiler is 4.8.1.  Compile as:

BillW-MacOSX-2<10323>
/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/bin/avr-g++
-c -Os -w -fno-exceptions -fno-threadsafe-statics -MMD
-mmcu=atmega328p oiOSoul-prepro.cpp

BillW-MacOSX-2<10324> avr-size oiOSoul-prepro.o
   text    data     bss     dec     hex filename
  44502      30      95   44627    ae53 oiOSoul-prepro.o

BillW-MacOSX-2<10325>
/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/bin/avr-g++
-c -Os -w -fno-exceptions  -fno-threadsafe-statics -MMD
-mmcu=atmega328p oiOSoul-prepro.cpp -fno-inline-small-functions

BillW-MacOSX-2<10326> avr-size oiOSoul-prepro.o
   text    data     bss     dec     hex filename
  12668      30      95   12793    31f9 oiOSoul-prepro.o

_______________________________________________
AVR-GCC-list mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/avr-gcc-list
oiOSoul-prepro.cpp (text/x-c++src, 71.7 KB)
# 1 "/var/folders/jz/5yb8f2hr8xjcpf0059bsfz4r0000gn/T/build219376009833811805.tmp/oiOSoul.cpp"
# 1 "/private/var/folders/jz/5yb8f2hr8xjcpf0059bsfz4r0000gn/T/build219376009833811805.tmp//"
# 1 "<command-line>"
# 1 "/var/folders/jz/5yb8f2hr8xjcpf0059bsfz4r0000gn/T/build219376009833811805.tmp/oiOSoul.cpp"
# 1 "oiOSoul.ino"




# 1 "/Volumes/Downloads/Downloads/Arduino 1.6.2.app/Contents/Java/libraries/Servo/src/Servo.h" 1
# 51 "/Volumes/Downloads/Downloads/Arduino 1.6.2.app/Contents/Java/libraries/Servo/src/Servo.h"
# 1 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/inttypes.h" 1 3
# 37 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/inttypes.h" 3
# 1 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/lib/gcc/avr/4.8.1/include/stdint.h" 1 3 4
# 9 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/lib/gcc/avr/4.8.1/include/stdint.h" 3 4
# 1 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdint.h" 1 3 4
# 121 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdint.h" 3 4
typedef signed int int8_t __attribute__((__mode__(__QI__)));
typedef unsigned int uint8_t __attribute__((__mode__(__QI__)));
typedef signed int int16_t __attribute__ ((__mode__ (__HI__)));
typedef unsigned int uint16_t __attribute__ ((__mode__ (__HI__)));
typedef signed int int32_t __attribute__ ((__mode__ (__SI__)));
typedef unsigned int uint32_t __attribute__ ((__mode__ (__SI__)));

typedef signed int int64_t __attribute__((__mode__(__DI__)));
typedef unsigned int uint64_t __attribute__((__mode__(__DI__)));
# 142 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdint.h" 3 4
typedef int16_t intptr_t;




typedef uint16_t uintptr_t;
# 159 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdint.h" 3 4
typedef int8_t int_least8_t;




typedef uint8_t uint_least8_t;




typedef int16_t int_least16_t;




typedef uint16_t uint_least16_t;




typedef int32_t int_least32_t;




typedef uint32_t uint_least32_t;







typedef int64_t int_least64_t;






typedef uint64_t uint_least64_t;
# 213 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdint.h" 3 4
typedef int8_t int_fast8_t;




typedef uint8_t uint_fast8_t;




typedef int16_t int_fast16_t;




typedef uint16_t uint_fast16_t;




typedef int32_t int_fast32_t;




typedef uint32_t uint_fast32_t;







typedef int64_t int_fast64_t;






typedef uint64_t uint_fast64_t;
# 273 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdint.h" 3 4
typedef int64_t intmax_t;




typedef uint64_t uintmax_t;
# 10 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/lib/gcc/avr/4.8.1/include/stdint.h" 2 3 4
# 38 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/inttypes.h" 2 3
# 77 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/inttypes.h" 3
typedef int32_t int_farptr_t;



typedef uint32_t uint_farptr_t;
# 52 "/Volumes/Downloads/Downloads/Arduino 1.6.2.app/Contents/Java/libraries/Servo/src/Servo.h" 2
# 63 "/Volumes/Downloads/Downloads/Arduino 1.6.2.app/Contents/Java/libraries/Servo/src/Servo.h"
# 1 "/Volumes/Downloads/Downloads/Arduino 1.6.2.app/Contents/Java/libraries/Servo/src/avr/ServoTimers.h" 1
# 57 "/Volumes/Downloads/Downloads/Arduino 1.6.2.app/Contents/Java/libraries/Servo/src/avr/ServoTimers.h"
typedef enum { _timer1, _Nbr_16timers } timer16_Sequence_t;
# 64 "/Volumes/Downloads/Downloads/Arduino 1.6.2.app/Contents/Java/libraries/Servo/src/Servo.h" 2
# 82 "/Volumes/Downloads/Downloads/Arduino 1.6.2.app/Contents/Java/libraries/Servo/src/Servo.h"
typedef struct {
  uint8_t nbr :6 ;
  uint8_t isActive :1 ;
} ServoPin_t ;

typedef struct {
  ServoPin_t Pin;
  volatile unsigned int ticks;
} servo_t;

class Servo
{
public:
  Servo();
  uint8_t attach(int pin);
  uint8_t attach(int pin, int min, int max);
  void detach();
  void write(int value);
  void writeMicroseconds(int value);
  int read();
  int readMicroseconds();
  bool attached();
private:
   uint8_t servoIndex;
   int8_t min;
   int8_t max;
};
# 6 "oiOSoul.ino" 2
# 1 "/Users/billw/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.h" 1
# 23 "/Users/billw/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.h"
# 1 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/Arduino.h" 1
# 23 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/Arduino.h"
# 1 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdlib.h" 1 3
# 47 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdlib.h" 3
# 1 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/lib/gcc/avr/4.8.1/include/stddef.h" 1 3 4
# 212 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/lib/gcc/avr/4.8.1/include/stddef.h" 3 4
typedef unsigned int size_t;
# 48 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdlib.h" 2 3






extern "C" {
# 68 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdlib.h" 3
typedef struct {
 int quot;
 int rem;
} div_t;


typedef struct {
 long quot;
 long rem;
} ldiv_t;


typedef int (*__compar_fn_t)(const void *, const void *);
# 114 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdlib.h" 3
extern void abort(void) __attribute__((__noreturn__));




extern int abs(int __i) __attribute__((__const__));
# 128 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdlib.h" 3
extern long labs(long __i) __attribute__((__const__));
# 151 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdlib.h" 3
extern void *bsearch(const void *__key, const void *__base, size_t __nmemb,
       size_t __size, int (*__compar)(const void *, const void *));







extern div_t div(int __num, int __denom) __asm__("__divmodhi4") __attribute__((__const__));





extern ldiv_t ldiv(long __num, long __denom) __asm__("__divmodsi4") __attribute__((__const__));
# 183 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdlib.h" 3
extern void qsort(void *__base, size_t __nmemb, size_t __size,
    __compar_fn_t __compar);
# 216 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdlib.h" 3
extern long strtol(const char *__nptr, char **__endptr, int __base);
# 250 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdlib.h" 3
extern unsigned long strtoul(const char *__nptr, char **__endptr, int __base);
# 262 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdlib.h" 3
extern long atol(const char *__s) __attribute__((__pure__));
# 274 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdlib.h" 3
extern int atoi(const char *__s) __attribute__((__pure__));
# 286 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdlib.h" 3
extern void exit(int __status) __attribute__((__noreturn__));
# 298 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdlib.h" 3
extern void *malloc(size_t __size) __attribute__((__malloc__));






extern void free(void *__ptr);




extern size_t __malloc_margin;




extern char *__malloc_heap_start;




extern char *__malloc_heap_end;






extern void *calloc(size_t __nele, size_t __size) __attribute__((__malloc__));
# 346 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdlib.h" 3
extern void *realloc(void *__ptr, size_t __size) __attribute__((__malloc__));

extern double strtod(const char *__nptr, char **__endptr);

extern double atof(const char *__nptr);
# 372 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdlib.h" 3
extern int rand(void);



extern void srand(unsigned int __seed);






extern int rand_r(unsigned long *__ctx);
# 417 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdlib.h" 3
extern __inline__
char *itoa (int __val, char *__s, int __radix)
{
    if (!__builtin_constant_p (__radix)) {
 extern char *__itoa (int, char *, int);
 return __itoa (__val, __s, __radix);
    } else if (__radix < 2 || __radix > 36) {
 *__s = 0;
 return __s;
    } else {
 extern char *__itoa_ncheck (int, char *, unsigned char);
 return __itoa_ncheck (__val, __s, __radix);
    }
}
# 462 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdlib.h" 3
extern __inline__
char *ltoa (long __val, char *__s, int __radix)
{
    if (!__builtin_constant_p (__radix)) {
 extern char *__ltoa (long, char *, int);
 return __ltoa (__val, __s, __radix);
    } else if (__radix < 2 || __radix > 36) {
 *__s = 0;
 return __s;
    } else {
 extern char *__ltoa_ncheck (long, char *, unsigned char);
 return __ltoa_ncheck (__val, __s, __radix);
    }
}
# 505 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdlib.h" 3
extern __inline__
char *utoa (unsigned int __val, char *__s, int __radix)
{
    if (!__builtin_constant_p (__radix)) {
 extern char *__utoa (unsigned int, char *, int);
 return __utoa (__val, __s, __radix);
    } else if (__radix < 2 || __radix > 36) {
 *__s = 0;
 return __s;
    } else {
 extern char *__utoa_ncheck (unsigned int, char *, unsigned char);
 return __utoa_ncheck (__val, __s, __radix);
    }
}
# 547 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdlib.h" 3
extern __inline__
char *ultoa (unsigned long __val, char *__s, int __radix)
{
    if (!__builtin_constant_p (__radix)) {
 extern char *__ultoa (unsigned long, char *, int);
 return __ultoa (__val, __s, __radix);
    } else if (__radix < 2 || __radix > 36) {
 *__s = 0;
 return __s;
    } else {
 extern char *__ultoa_ncheck (unsigned long, char *, unsigned char);
 return __ultoa_ncheck (__val, __s, __radix);
    }
}
# 579 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdlib.h" 3
extern long random(void);




extern void srandom(unsigned long __seed);







extern long random_r(unsigned long *__ctx);
# 638 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdlib.h" 3
extern char *dtostre(double __val, char *__s, unsigned char __prec,
       unsigned char __flags);
# 655 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdlib.h" 3
extern char *dtostrf(double __val, signed char __width,
                     unsigned char __prec, char *__s);
# 677 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdlib.h" 3
}
# 24 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/Arduino.h" 2
# 1 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/lib/gcc/avr/4.8.1/include/stdbool.h" 1 3 4
# 25 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/Arduino.h" 2
# 1 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/string.h" 1 3
# 45 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/string.h" 3
# 1 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/lib/gcc/avr/4.8.1/include/stddef.h" 1 3 4
# 46 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/string.h" 2 3
# 56 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/string.h" 3
extern "C" {
# 111 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/string.h" 3
extern int ffs (int __val) __attribute__((__const__));
extern int ffsl (long __val) __attribute__((__const__));
extern int ffsll (long long __val) __attribute__((__const__));
extern void *memccpy(void *, const void *, int, size_t);
extern void *memchr(const void *, int, size_t) __attribute__((__pure__));
extern int memcmp(const void *, const void *, size_t) __attribute__((__pure__));
extern void *memcpy(void *, const void *, size_t);
extern void *memmem(const void *, size_t, const void *, size_t) __attribute__((__pure__));
extern void *memmove(void *, const void *, size_t);
extern void *memrchr(const void *, int, size_t) __attribute__((__pure__));
extern void *memset(void *, int, size_t);
extern char *strcat(char *, const char *);
extern char *strchr(const char *, int) __attribute__((__pure__));
extern char *strchrnul(const char *, int) __attribute__((__pure__));
extern int strcmp(const char *, const char *) __attribute__((__pure__));
extern char *strcpy(char *, const char *);
extern int strcasecmp(const char *, const char *) __attribute__((__pure__));
extern char *strcasestr(const char *, const char *) __attribute__((__pure__));
extern size_t strcspn(const char *__s, const char *__reject) __attribute__((__pure__));
extern char *strdup(const char *s1);
extern size_t strlcat(char *, const char *, size_t);
extern size_t strlcpy(char *, const char *, size_t);
extern size_t strlen(const char *) __attribute__((__pure__));
extern char *strlwr(char *);
extern char *strncat(char *, const char *, size_t);
extern int strncmp(const char *, const char *, size_t) __attribute__((__pure__));
extern char *strncpy(char *, const char *, size_t);
extern int strncasecmp(const char *, const char *, size_t) __attribute__((__pure__));
extern size_t strnlen(const char *, size_t) __attribute__((__pure__));
extern char *strpbrk(const char *__s, const char *__accept) __attribute__((__pure__));
extern char *strrchr(const char *, int) __attribute__((__pure__));
extern char *strrev(char *);
extern char *strsep(char **, const char *);
extern size_t strspn(const char *__s, const char *__accept) __attribute__((__pure__));
extern char *strstr(const char *, const char *) __attribute__((__pure__));
extern char *strtok(char *, const char *);
extern char *strtok_r(char *, const char *, char **);
extern char *strupr(char *);


}
# 26 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/Arduino.h" 2
# 1 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/math.h" 1 3
# 121 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/math.h" 3
extern "C" {





extern double cos(double __x) __attribute__((__const__));





extern double sin(double __x) __attribute__((__const__));





extern double tan(double __x) __attribute__((__const__));






extern double fabs(double __x) __attribute__((__const__));






extern double fmod(double __x, double __y) __attribute__((__const__));
# 168 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/math.h" 3
extern double modf(double __x, double *__iptr);



extern float modff (float __x, float *__iptr);




extern double sqrt(double __x) __attribute__((__const__));





extern double cbrt(double __x) __attribute__((__const__));
# 194 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/math.h" 3
extern double hypot (double __x, double __y) __attribute__((__const__));







extern double square(double __x) __attribute__((__const__));






extern double floor(double __x) __attribute__((__const__));






extern double ceil(double __x) __attribute__((__const__));
# 234 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/math.h" 3
extern double frexp(double __x, int *__pexp);







extern double ldexp(double __x, int __exp) __attribute__((__const__));





extern double exp(double __x) __attribute__((__const__));





extern double cosh(double __x) __attribute__((__const__));





extern double sinh(double __x) __attribute__((__const__));





extern double tanh(double __x) __attribute__((__const__));







extern double acos(double __x) __attribute__((__const__));







extern double asin(double __x) __attribute__((__const__));






extern double atan(double __x) __attribute__((__const__));
# 298 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/math.h" 3
extern double atan2(double __y, double __x) __attribute__((__const__));





extern double log(double __x) __attribute__((__const__));





extern double log10(double __x) __attribute__((__const__));





extern double pow(double __x, double __y) __attribute__((__const__));






extern int isnan(double __x) __attribute__((__const__));
# 333 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/math.h" 3
extern int isinf(double __x) __attribute__((__const__));






__attribute__((__const__)) static inline int isfinite (double __x)
{
    unsigned char __exp;
    __asm__ (
 "mov	%0, %C1		\n\t"
 "lsl	%0		\n\t"
 "mov	%0, %D1		\n\t"
 "rol	%0		"
 : "=r" (__exp)
 : "r" (__x) );
    return __exp != 0xff;
}






__attribute__((__const__)) static inline double copysign (double __x, double __y)
{
    __asm__ (
 "bst	%D2, 7	\n\t"
 "bld	%D0, 7	"
 : "=r" (__x)
 : "0" (__x), "r" (__y) );
    return __x;
}
# 376 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/math.h" 3
extern int signbit (double __x) __attribute__((__const__));






extern double fdim (double __x, double __y) __attribute__((__const__));
# 392 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/math.h" 3
extern double fma (double __x, double __y, double __z) __attribute__((__const__));







extern double fmax (double __x, double __y) __attribute__((__const__));







extern double fmin (double __x, double __y) __attribute__((__const__));






extern double trunc (double __x) __attribute__((__const__));
# 426 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/math.h" 3
extern double round (double __x) __attribute__((__const__));
# 439 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/math.h" 3
extern long lround (double __x) __attribute__((__const__));
# 453 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/math.h" 3
extern long lrint (double __x) __attribute__((__const__));



}
# 27 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/Arduino.h" 2

# 1 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/avr/pgmspace.h" 1 3
# 87 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/avr/pgmspace.h" 3
# 1 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/lib/gcc/avr/4.8.1/include/stddef.h" 1 3 4
# 88 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/avr/pgmspace.h" 2 3
# 1 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/avr/io.h" 1 3
# 99 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/avr/io.h" 3
# 1 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/avr/sfr_defs.h" 1 3
# 100 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/avr/io.h" 2 3
# 272 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/avr/io.h" 3
# 1 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/avr/iom328p.h" 1 3
# 273 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/avr/io.h" 2 3
# 616 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/avr/io.h" 3
# 1 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/avr/portpins.h" 1 3
# 617 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/avr/io.h" 2 3

# 1 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/avr/common.h" 1 3
# 619 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/avr/io.h" 2 3

# 1 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/avr/version.h" 1 3
# 621 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/avr/io.h" 2 3






# 1 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/avr/fuse.h" 1 3
# 239 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/avr/fuse.h" 3
typedef struct
{
    unsigned char low;
    unsigned char high;
    unsigned char extended;
} __fuse_t;
# 628 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/avr/io.h" 2 3


# 1 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/avr/lock.h" 1 3
# 631 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/avr/io.h" 2 3
# 89 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/avr/pgmspace.h" 2 3
# 112 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/avr/pgmspace.h" 3
extern "C" {
# 1137 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/avr/pgmspace.h" 3
extern const void * memchr_P(const void *, int __val, size_t __len) __attribute__((__const__));
extern int memcmp_P(const void *, const void *, size_t) __attribute__((__pure__));
extern void *memccpy_P(void *, const void *, int __val, size_t);
extern void *memcpy_P(void *, const void *, size_t);
extern void *memmem_P(const void *, size_t, const void *, size_t) __attribute__((__pure__));
extern const void * memrchr_P(const void *, int __val, size_t __len) __attribute__((__const__));
extern char *strcat_P(char *, const char *);
extern const char * strchr_P(const char *, int __val) __attribute__((__const__));
extern const char * strchrnul_P(const char *, int __val) __attribute__((__const__));
extern int strcmp_P(const char *, const char *) __attribute__((__pure__));
extern char *strcpy_P(char *, const char *);
extern int strcasecmp_P(const char *, const char *) __attribute__((__pure__));
extern char *strcasestr_P(const char *, const char *) __attribute__((__pure__));
extern size_t strcspn_P(const char *__s, const char * __reject) __attribute__((__pure__));
extern size_t strlcat_P (char *, const char *, size_t );
extern size_t strlcpy_P (char *, const char *, size_t );
extern size_t __strlen_P(const char *) __attribute__((__const__));
extern size_t strnlen_P(const char *, size_t) __attribute__((__const__));
extern int strncmp_P(const char *, const char *, size_t) __attribute__((__pure__));
extern int strncasecmp_P(const char *, const char *, size_t) __attribute__((__pure__));
extern char *strncat_P(char *, const char *, size_t);
extern char *strncpy_P(char *, const char *, size_t);
extern char *strpbrk_P(const char *__s, const char * __accept) __attribute__((__pure__));
extern const char * strrchr_P(const char *, int __val) __attribute__((__const__));
extern char *strsep_P(char **__sp, const char * __delim);
extern size_t strspn_P(const char *__s, const char * __accept) __attribute__((__pure__));
extern char *strstr_P(const char *, const char *) __attribute__((__pure__));
extern char *strtok_P(char *__s, const char * __delim);
extern char *strtok_rP(char *__s, const char * __delim, char **__last);

extern size_t strlen_PF (uint_farptr_t src) __attribute__((__const__));
extern size_t strnlen_PF (uint_farptr_t src, size_t len) __attribute__((__const__));
extern void *memcpy_PF (void *dest, uint_farptr_t src, size_t len);
extern char *strcpy_PF (char *dest, uint_farptr_t src);
extern char *strncpy_PF (char *dest, uint_farptr_t src, size_t len);
extern char *strcat_PF (char *dest, uint_farptr_t src);
extern size_t strlcat_PF (char *dst, uint_farptr_t src, size_t siz);
extern char *strncat_PF (char *dest, uint_farptr_t src, size_t len);
extern int strcmp_PF (const char *s1, uint_farptr_t s2) __attribute__((__pure__));
extern int strncmp_PF (const char *s1, uint_farptr_t s2, size_t n) __attribute__((__pure__));
extern int strcasecmp_PF (const char *s1, uint_farptr_t s2) __attribute__((__pure__));
extern int strncasecmp_PF (const char *s1, uint_farptr_t s2, size_t n) __attribute__((__pure__));
extern char *strstr_PF (const char *s1, uint_farptr_t s2);
extern size_t strlcpy_PF (char *dst, uint_farptr_t src, size_t siz);
extern int memcmp_PF(const void *, uint_farptr_t, size_t) __attribute__((__pure__));


__attribute__((__always_inline__)) static inline size_t strlen_P(const char * s);
static inline size_t strlen_P(const char *s) {
  return __builtin_constant_p(__builtin_strlen(s))
     ? __builtin_strlen(s) : __strlen_P(s);
}




}
# 29 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/Arduino.h" 2

# 1 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/avr/interrupt.h" 1 3
# 31 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/Arduino.h" 2

# 1 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/binary.h" 1
# 33 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/Arduino.h" 2


extern "C"{


void yield(void);
# 113 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/Arduino.h"
typedef unsigned int word;



typedef bool boolean;
typedef uint8_t byte;

void init(void);
void initVariant(void);

int atexit(void (*func)()) __attribute__((weak));

void pinMode(uint8_t, uint8_t);
void digitalWrite(uint8_t, uint8_t);
int digitalRead(uint8_t);
int analogRead(uint8_t);
void analogReference(uint8_t mode);
void analogWrite(uint8_t, int);

unsigned long millis(void);
unsigned long micros(void);
void delay(unsigned long);
void delayMicroseconds(unsigned int us);
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout);

void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder);

void attachInterrupt(uint8_t, void (*)(void), int mode);
void detachInterrupt(uint8_t);

void setup(void);
void loop(void);
# 154 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/Arduino.h"
extern const uint16_t __attribute__((__progmem__)) port_to_mode_PGM[];
extern const uint16_t __attribute__((__progmem__)) port_to_input_PGM[];
extern const uint16_t __attribute__((__progmem__)) port_to_output_PGM[];

extern const uint8_t __attribute__((__progmem__)) digital_pin_to_port_PGM[];

extern const uint8_t __attribute__((__progmem__)) digital_pin_to_bit_mask_PGM[];
extern const uint8_t __attribute__((__progmem__)) digital_pin_to_timer_PGM[];
# 217 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/Arduino.h"
}



# 1 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/WCharacter.h" 1
# 23 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/WCharacter.h"
# 1 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/ctype.h" 1 3
# 48 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/ctype.h" 3
extern "C" {
# 74 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/ctype.h" 3
extern int isalnum(int __c) __attribute__((__const__));






extern int isalpha(int __c) __attribute__((__const__));






extern int isascii(int __c) __attribute__((__const__));





extern int isblank(int __c) __attribute__((__const__));





extern int iscntrl(int __c) __attribute__((__const__));





extern int isdigit(int __c) __attribute__((__const__));





extern int isgraph(int __c) __attribute__((__const__));





extern int islower(int __c) __attribute__((__const__));





extern int isprint(int __c) __attribute__((__const__));






extern int ispunct(int __c) __attribute__((__const__));







extern int isspace(int __c) __attribute__((__const__));





extern int isupper(int __c) __attribute__((__const__));






extern int isxdigit(int __c) __attribute__((__const__));
# 173 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/ctype.h" 3
extern int toascii(int __c) __attribute__((__const__));





extern int tolower(int __c) __attribute__((__const__));





extern int toupper(int __c) __attribute__((__const__));




}
# 24 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/WCharacter.h" 2


inline boolean isAlphaNumeric(int c) __attribute__((always_inline));
inline boolean isAlpha(int c) __attribute__((always_inline));
inline boolean isAscii(int c) __attribute__((always_inline));
inline boolean isWhitespace(int c) __attribute__((always_inline));
inline boolean isControl(int c) __attribute__((always_inline));
inline boolean isDigit(int c) __attribute__((always_inline));
inline boolean isGraph(int c) __attribute__((always_inline));
inline boolean isLowerCase(int c) __attribute__((always_inline));
inline boolean isPrintable(int c) __attribute__((always_inline));
inline boolean isPunct(int c) __attribute__((always_inline));
inline boolean isSpace(int c) __attribute__((always_inline));
inline boolean isUpperCase(int c) __attribute__((always_inline));
inline boolean isHexadecimalDigit(int c) __attribute__((always_inline));
inline int toAscii(int c) __attribute__((always_inline));
inline int toLowerCase(int c) __attribute__((always_inline));
inline int toUpperCase(int c)__attribute__((always_inline));




inline boolean isAlphaNumeric(int c)
{
  return ( isalnum(c) == 0 ? false : true);
}




inline boolean isAlpha(int c)
{
  return ( isalpha(c) == 0 ? false : true);
}




inline boolean isAscii(int c)
{
  return ( isascii (c) == 0 ? false : true);
}



inline boolean isWhitespace(int c)
{
  return ( isblank (c) == 0 ? false : true);
}



inline boolean isControl(int c)
{
  return ( iscntrl (c) == 0 ? false : true);
}



inline boolean isDigit(int c)
{
  return ( isdigit (c) == 0 ? false : true);
}



inline boolean isGraph(int c)
{
  return ( isgraph (c) == 0 ? false : true);
}



inline boolean isLowerCase(int c)
{
  return (islower (c) == 0 ? false : true);
}



inline boolean isPrintable(int c)
{
  return ( isprint (c) == 0 ? false : true);
}




inline boolean isPunct(int c)
{
  return ( ispunct (c) == 0 ? false : true);
}





inline boolean isSpace(int c)
{
  return ( isspace (c) == 0 ? false : true);
}



inline boolean isUpperCase(int c)
{
  return ( isupper (c) == 0 ? false : true);
}




inline boolean isHexadecimalDigit(int c)
{
  return ( isxdigit (c) == 0 ? false : true);
}




inline int toAscii(int c)
{
  return toascii (c);
}
# 156 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/WCharacter.h"
inline int toLowerCase(int c)
{
  return tolower (c);
}



inline int toUpperCase(int c)
{
  return toupper (c);
}
# 222 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/Arduino.h" 2
# 1 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/WString.h" 1
# 37 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/WString.h"
class __FlashStringHelper;




class StringSumHelper;


class String
{



 typedef void (String::*StringIfHelperType)() const;
 void StringIfHelper() const {}

public:





 String(const char *cstr = "");
 String(const String &str);
 String(const __FlashStringHelper *str);




 explicit String(char c);
 explicit String(unsigned char, unsigned char base=10);
 explicit String(int, unsigned char base=10);
 explicit String(unsigned int, unsigned char base=10);
 explicit String(long, unsigned char base=10);
 explicit String(unsigned long, unsigned char base=10);
 explicit String(float, unsigned char decimalPlaces=2);
 explicit String(double, unsigned char decimalPlaces=2);
 ~String(void);





 unsigned char reserve(unsigned int size);
 inline unsigned int length(void) const {return len;}




 String & operator = (const String &rhs);
 String & operator = (const char *cstr);
 String & operator = (const __FlashStringHelper *str);
# 99 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/WString.h"
 unsigned char concat(const String &str);
 unsigned char concat(const char *cstr);
 unsigned char concat(char c);
 unsigned char concat(unsigned char c);
 unsigned char concat(int num);
 unsigned char concat(unsigned int num);
 unsigned char concat(long num);
 unsigned char concat(unsigned long num);
 unsigned char concat(float num);
 unsigned char concat(double num);
 unsigned char concat(const __FlashStringHelper * str);



 String & operator += (const String &rhs) {concat(rhs); return (*this);}
 String & operator += (const char *cstr) {concat(cstr); return (*this);}
 String & operator += (char c) {concat(c); return (*this);}
 String & operator += (unsigned char num) {concat(num); return (*this);}
 String & operator += (int num) {concat(num); return (*this);}
 String & operator += (unsigned int num) {concat(num); return (*this);}
 String & operator += (long num) {concat(num); return (*this);}
 String & operator += (unsigned long num) {concat(num); return (*this);}
 String & operator += (float num) {concat(num); return (*this);}
 String & operator += (double num) {concat(num); return (*this);}
 String & operator += (const __FlashStringHelper *str){concat(str); return (*this);}

 friend StringSumHelper & operator + (const StringSumHelper &lhs, const String &rhs);
 friend StringSumHelper & operator + (const StringSumHelper &lhs, const char *cstr);
 friend StringSumHelper & operator + (const StringSumHelper &lhs, char c);
 friend StringSumHelper & operator + (const StringSumHelper &lhs, unsigned char num);
 friend StringSumHelper & operator + (const StringSumHelper &lhs, int num);
 friend StringSumHelper & operator + (const StringSumHelper &lhs, unsigned int num);
 friend StringSumHelper & operator + (const StringSumHelper &lhs, long num);
 friend StringSumHelper & operator + (const StringSumHelper &lhs, unsigned long num);
 friend StringSumHelper & operator + (const StringSumHelper &lhs, float num);
 friend StringSumHelper & operator + (const StringSumHelper &lhs, double num);
 friend StringSumHelper & operator + (const StringSumHelper &lhs, const __FlashStringHelper *rhs);


 operator StringIfHelperType() const { return buffer ? &String::StringIfHelper : 0; }
 int compareTo(const String &s) const;
 unsigned char equals(const String &s) const;
 unsigned char equals(const char *cstr) const;
 unsigned char operator == (const String &rhs) const {return equals(rhs);}
 unsigned char operator == (const char *cstr) const {return equals(cstr);}
 unsigned char operator != (const String &rhs) const {return !equals(rhs);}
 unsigned char operator != (const char *cstr) const {return !equals(cstr);}
 unsigned char operator < (const String &rhs) const;
 unsigned char operator > (const String &rhs) const;
 unsigned char operator <= (const String &rhs) const;
 unsigned char operator >= (const String &rhs) const;
 unsigned char equalsIgnoreCase(const String &s) const;
 unsigned char startsWith( const String &prefix) const;
 unsigned char startsWith(const String &prefix, unsigned int offset) const;
 unsigned char endsWith(const String &suffix) const;


 char charAt(unsigned int index) const;
 void setCharAt(unsigned int index, char c);
 char operator [] (unsigned int index) const;
 char& operator [] (unsigned int index);
 void getBytes(unsigned char *buf, unsigned int bufsize, unsigned int index=0) const;
 void toCharArray(char *buf, unsigned int bufsize, unsigned int index=0) const
  {getBytes((unsigned char *)buf, bufsize, index);}
 const char * c_str() const { return buffer; }


 int indexOf( char ch ) const;
 int indexOf( char ch, unsigned int fromIndex ) const;
 int indexOf( const String &str ) const;
 int indexOf( const String &str, unsigned int fromIndex ) const;
 int lastIndexOf( char ch ) const;
 int lastIndexOf( char ch, unsigned int fromIndex ) const;
 int lastIndexOf( const String &str ) const;
 int lastIndexOf( const String &str, unsigned int fromIndex ) const;
 String substring( unsigned int beginIndex ) const { return substring(beginIndex, len); };
 String substring( unsigned int beginIndex, unsigned int endIndex ) const;


 void replace(char find, char replace);
 void replace(const String& find, const String& replace);
 void remove(unsigned int index);
 void remove(unsigned int index, unsigned int count);
 void toLowerCase(void);
 void toUpperCase(void);
 void trim(void);


 long toInt(void) const;
 float toFloat(void) const;

protected:
 char *buffer;
 unsigned int capacity;
 unsigned int len;
protected:
 void init(void);
 void invalidate(void);
 unsigned char changeBuffer(unsigned int maxStrLen);
 unsigned char concat(const char *cstr, unsigned int length);


 String & copy(const char *cstr, unsigned int length);
 String & copy(const __FlashStringHelper *pstr, unsigned int length);



};

class StringSumHelper : public String
{
public:
 StringSumHelper(const String &s) : String(s) {}
 StringSumHelper(const char *p) : String(p) {}
 StringSumHelper(char c) : String(c) {}
 StringSumHelper(unsigned char num) : String(num) {}
 StringSumHelper(int num) : String(num) {}
 StringSumHelper(unsigned int num) : String(num) {}
 StringSumHelper(long num) : String(num) {}
 StringSumHelper(unsigned long num) : String(num) {}
 StringSumHelper(float num) : String(num) {}
 StringSumHelper(double num) : String(num) {}
};
# 223 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/Arduino.h" 2
# 1 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/HardwareSerial.h" 1
# 29 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/HardwareSerial.h"
# 1 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/Stream.h" 1
# 26 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/Stream.h"
# 1 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/Print.h" 1
# 24 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/Print.h"
# 1 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdio.h" 1 3
# 45 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdio.h" 3
# 1 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/lib/gcc/avr/4.8.1/include/stdarg.h" 1 3 4
# 40 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/lib/gcc/avr/4.8.1/include/stdarg.h" 3 4
typedef __builtin_va_list __gnuc_va_list;
# 98 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/lib/gcc/avr/4.8.1/include/stdarg.h" 3 4
typedef __gnuc_va_list va_list;
# 46 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdio.h" 2 3



# 1 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/lib/gcc/avr/4.8.1/include/stddef.h" 1 3 4
# 50 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdio.h" 2 3
# 242 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdio.h" 3
struct __file {
 char *buf;
 unsigned char unget;
 uint8_t flags;
# 261 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdio.h" 3
 int size;
 int len;
 int (*put)(char, struct __file *);
 int (*get)(struct __file *);
 void *udata;
};
# 397 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdio.h" 3
extern "C" {







extern struct __file *__iob[];
# 417 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdio.h" 3
extern struct __file *fdevopen(int (*__put)(char, struct __file*), int (*__get)(struct __file*));
# 434 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdio.h" 3
extern int fclose(struct __file *__stream);
# 608 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdio.h" 3
extern int vfprintf(struct __file *__stream, const char *__fmt, va_list __ap);





extern int vfprintf_P(struct __file *__stream, const char *__fmt, va_list __ap);






extern int fputc(int __c, struct __file *__stream);




extern int putc(int __c, struct __file *__stream);


extern int putchar(int __c);
# 649 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdio.h" 3
extern int printf(const char *__fmt, ...);





extern int printf_P(const char *__fmt, ...);







extern int vprintf(const char *__fmt, va_list __ap);





extern int sprintf(char *__s, const char *__fmt, ...);





extern int sprintf_P(char *__s, const char *__fmt, ...);
# 685 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdio.h" 3
extern int snprintf(char *__s, size_t __n, const char *__fmt, ...);





extern int snprintf_P(char *__s, size_t __n, const char *__fmt, ...);





extern int vsprintf(char *__s, const char *__fmt, va_list ap);





extern int vsprintf_P(char *__s, const char *__fmt, va_list ap);
# 713 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdio.h" 3
extern int vsnprintf(char *__s, size_t __n, const char *__fmt, va_list ap);





extern int vsnprintf_P(char *__s, size_t __n, const char *__fmt, va_list ap);




extern int fprintf(struct __file *__stream, const char *__fmt, ...);





extern int fprintf_P(struct __file *__stream, const char *__fmt, ...);






extern int fputs(const char *__str, struct __file *__stream);




extern int fputs_P(const char *__str, struct __file *__stream);





extern int puts(const char *__str);




extern int puts_P(const char *__str);
# 762 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdio.h" 3
extern size_t fwrite(const void *__ptr, size_t __size, size_t __nmemb,
         struct __file *__stream);







extern int fgetc(struct __file *__stream);




extern int getc(struct __file *__stream);


extern int getchar(void);
# 810 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdio.h" 3
extern int ungetc(int __c, struct __file *__stream);
# 822 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdio.h" 3
extern char *fgets(char *__str, int __size, struct __file *__stream);






extern char *gets(char *__str);
# 840 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdio.h" 3
extern size_t fread(void *__ptr, size_t __size, size_t __nmemb,
        struct __file *__stream);




extern void clearerr(struct __file *__stream);
# 857 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdio.h" 3
extern int feof(struct __file *__stream);
# 868 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdio.h" 3
extern int ferror(struct __file *__stream);






extern int vfscanf(struct __file *__stream, const char *__fmt, va_list __ap);




extern int vfscanf_P(struct __file *__stream, const char *__fmt, va_list __ap);







extern int fscanf(struct __file *__stream, const char *__fmt, ...);




extern int fscanf_P(struct __file *__stream, const char *__fmt, ...);






extern int scanf(const char *__fmt, ...);




extern int scanf_P(const char *__fmt, ...);







extern int vscanf(const char *__fmt, va_list __ap);







extern int sscanf(const char *__buf, const char *__fmt, ...);




extern int sscanf_P(const char *__buf, const char *__fmt, ...);
# 938 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/stdio.h" 3
static __inline__ int fflush(struct __file *stream __attribute__((unused)))
{
 return 0;
}



}
# 25 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/Print.h" 2


# 1 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/Printable.h" 1
# 25 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/Printable.h"
class Print;







class Printable
{
  public:
    virtual size_t printTo(Print& p) const = 0;
};
# 28 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/Print.h" 2






class Print
{
  private:
    int write_error;
    size_t printNumber(unsigned long, uint8_t);
    size_t printFloat(double, uint8_t);
  protected:
    void setWriteError(int err = 1) { write_error = err; }
  public:
    Print() : write_error(0) {}

    int getWriteError() { return write_error; }
    void clearWriteError() { setWriteError(0); }

    virtual size_t write(uint8_t) = 0;
    size_t write(const char *str) {
      if (str == __null) return 0;
      return write((const uint8_t *)str, strlen(str));
    }
    virtual size_t write(const uint8_t *buffer, size_t size);
    size_t write(const char *buffer, size_t size) {
      return write((const uint8_t *)buffer, size);
    }

    size_t print(const __FlashStringHelper *);
    size_t print(const String &);
    size_t print(const char[]);
    size_t print(char);
    size_t print(unsigned char, int = 10);
    size_t print(int, int = 10);
    size_t print(unsigned int, int = 10);
    size_t print(long, int = 10);
    size_t print(unsigned long, int = 10);
    size_t print(double, int = 2);
    size_t print(const Printable&);

    size_t println(const __FlashStringHelper *);
    size_t println(const String &s);
    size_t println(const char[]);
    size_t println(char);
    size_t println(unsigned char, int = 10);
    size_t println(int, int = 10);
    size_t println(unsigned int, int = 10);
    size_t println(long, int = 10);
    size_t println(unsigned long, int = 10);
    size_t println(double, int = 2);
    size_t println(const Printable&);
    size_t println(void);
};
# 27 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/Stream.h" 2
# 38 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/Stream.h"
class Stream : public Print
{
  protected:
    unsigned long _timeout;
    unsigned long _startMillis;
    int timedRead();
    int timedPeek();
    int peekNextDigit();

  public:
    virtual int available() = 0;
    virtual int read() = 0;
    virtual int peek() = 0;
    virtual void flush() = 0;

    Stream() {_timeout=1000;}



  void setTimeout(unsigned long timeout);

  bool find(char *target);
  bool find(uint8_t *target) { return find ((char *)target); }


  bool find(char *target, size_t length);
  bool find(uint8_t *target, size_t length) { return find ((char *)target, length); }


  bool findUntil(char *target, char *terminator);
  bool findUntil(uint8_t *target, char *terminator) { return findUntil((char *)target, terminator); }

  bool findUntil(char *target, size_t targetLen, char *terminate, size_t termLen);
  bool findUntil(uint8_t *target, size_t targetLen, char *terminate, size_t termLen) {return findUntil((char *)target, targetLen, terminate, termLen); }


  long parseInt();



  float parseFloat();

  size_t readBytes( char *buffer, size_t length);
  size_t readBytes( uint8_t *buffer, size_t length) { return readBytes((char *)buffer, length); }



  size_t readBytesUntil( char terminator, char *buffer, size_t length);
  size_t readBytesUntil( char terminator, uint8_t *buffer, size_t length) { return readBytesUntil(terminator, (char *)buffer, length); }




  String readString();
  String readStringUntil(char terminator);

  protected:
  long parseInt(char skipChar);



  float parseFloat(char skipChar);

  struct MultiTarget {
    const char *str;
    size_t len;
    size_t index;
  };



  int findMulti(struct MultiTarget *targets, int tCount);
};
# 30 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/HardwareSerial.h" 2
# 49 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/HardwareSerial.h"
typedef uint8_t tx_buffer_index_t;




typedef uint8_t rx_buffer_index_t;
# 83 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/HardwareSerial.h"
class HardwareSerial : public Stream
{
  protected:
    volatile uint8_t * const _ubrrh;
    volatile uint8_t * const _ubrrl;
    volatile uint8_t * const _ucsra;
    volatile uint8_t * const _ucsrb;
    volatile uint8_t * const _ucsrc;
    volatile uint8_t * const _udr;

    bool _written;

    volatile rx_buffer_index_t _rx_buffer_head;
    volatile rx_buffer_index_t _rx_buffer_tail;
    volatile tx_buffer_index_t _tx_buffer_head;
    volatile tx_buffer_index_t _tx_buffer_tail;




    unsigned char _rx_buffer[64];
    unsigned char _tx_buffer[64];

  public:
    inline HardwareSerial(
      volatile uint8_t *ubrrh, volatile uint8_t *ubrrl,
      volatile uint8_t *ucsra, volatile uint8_t *ucsrb,
      volatile uint8_t *ucsrc, volatile uint8_t *udr);
    void begin(unsigned long baud) { begin(baud, 0x06); }
    void begin(unsigned long, uint8_t);
    void end();
    virtual int available(void);
    virtual int peek(void);
    virtual int read(void);
    int availableForWrite(void);
    virtual void flush(void);
    virtual size_t write(uint8_t);
    inline size_t write(unsigned long n) { return write((uint8_t)n); }
    inline size_t write(long n) { return write((uint8_t)n); }
    inline size_t write(unsigned int n) { return write((uint8_t)n); }
    inline size_t write(int n) { return write((uint8_t)n); }
    using Print::write;
    operator bool() { return true; }


    inline void _rx_complete_irq(void);
    void _tx_udr_empty_irq(void);
};


  extern HardwareSerial Serial;
# 149 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/HardwareSerial.h"
extern void serialEventRun(void) __attribute__((weak));
# 224 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/Arduino.h" 2
# 1 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/USBAPI.h" 1
# 25 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/USBAPI.h"
# 1 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/avr/eeprom.h" 1 3
# 570 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/avr/eeprom.h" 3
# 1 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/lib/gcc/avr/4.8.1/include/stddef.h" 1 3 4
# 147 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/lib/gcc/avr/4.8.1/include/stddef.h" 3 4
typedef int ptrdiff_t;
# 571 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/avr/eeprom.h" 2 3
# 612 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/avr/eeprom.h" 3
extern "C" {
# 657 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/avr/eeprom.h" 3
uint8_t __eerd_byte_m328p (const uint8_t *__p) __attribute__((__pure__));




uint16_t __eerd_word_m328p (const uint16_t *__p) __attribute__((__pure__));




uint32_t __eerd_dword_m328p (const uint32_t *__p) __attribute__((__pure__));




float __eerd_float_m328p (const float *__p) __attribute__((__pure__));





void __eerd_block_m328p (void *__dst, const void *__src, size_t __n);





void __eewr_byte_m328p (uint8_t *__p, uint8_t __value);




void __eewr_word_m328p (uint16_t *__p, uint16_t __value);




void __eewr_dword_m328p (uint32_t *__p, uint32_t __value);




void __eewr_float_m328p (float *__p, float __value);





void __eewr_block_m328p (const void *__src, void *__dst, size_t __n);





void __eeupd_byte_m328p (uint8_t *__p, uint8_t __value);




void __eeupd_word_m328p (uint16_t *__p, uint16_t __value);




void __eeupd_dword_m328p (uint32_t *__p, uint32_t __value);




void __eeupd_float_m328p (float *__p, float __value);





void __eeupd_block_m328p (const void *__src, void *__dst, size_t __n);
# 761 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/avr/eeprom.h" 3
}
# 26 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/USBAPI.h" 2

# 1 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/util/delay.h" 1 3
# 43 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/util/delay.h" 3
# 1 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/util/delay_basic.h" 1 3
# 40 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/util/delay_basic.h" 3
static inline void _delay_loop_1(uint8_t __count) __attribute__((always_inline));
static inline void _delay_loop_2(uint16_t __count) __attribute__((always_inline));
# 80 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/util/delay_basic.h" 3
void
_delay_loop_1(uint8_t __count)
{
 __asm__ volatile (
  "1: dec %0" "\n\t"
  "brne 1b"
  : "=r" (__count)
  : "0" (__count)
 );
}
# 102 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/util/delay_basic.h" 3
void
_delay_loop_2(uint16_t __count)
{
 __asm__ volatile (
  "1: sbiw %0,1" "\n\t"
  "brne 1b"
  : "=w" (__count)
  : "0" (__count)
 );
}
# 44 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/util/delay.h" 2 3
# 84 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/util/delay.h" 3
static inline void _delay_us(double __us) __attribute__((always_inline));
static inline void _delay_ms(double __ms) __attribute__((always_inline));
# 141 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/util/delay.h" 3
void
_delay_ms(double __ms)
{
 double __tmp ;



 uint32_t __ticks_dc;
 extern void __builtin_avr_delay_cycles(unsigned long);
 __tmp = ((16000000L) / 1e3) * __ms;
# 160 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/util/delay.h" 3
  __ticks_dc = (uint32_t)(ceil(fabs(__tmp)));


 __builtin_avr_delay_cycles(__ticks_dc);
# 186 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/util/delay.h" 3
}
# 223 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/util/delay.h" 3
void
_delay_us(double __us)
{
 double __tmp ;



 uint32_t __ticks_dc;
 extern void __builtin_avr_delay_cycles(unsigned long);
 __tmp = ((16000000L) / 1e6) * __us;
# 242 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/util/delay.h" 3
  __ticks_dc = (uint32_t)(ceil(fabs(__tmp)));


 __builtin_avr_delay_cycles(__ticks_dc);
# 268 "/Users/billw/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino2/avr/include/util/delay.h" 3
}
# 28 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/USBAPI.h" 2

typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned long u32;

# 1 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/Arduino.h" 1
# 34 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/USBAPI.h" 2
# 225 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/Arduino.h" 2




uint16_t makeWord(uint16_t w);
uint16_t makeWord(byte h, byte l);



unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);

void tone(uint8_t _pin, unsigned int frequency, unsigned long duration = 0);
void noTone(uint8_t _pin);


long random(long);
long random(long, long);
void randomSeed(unsigned int);
long map(long, long, long, long, long);



# 1 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/variants/standard/pins_arduino.h" 1
# 40 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/variants/standard/pins_arduino.h"
static const uint8_t SS = 10;
static const uint8_t MOSI = 11;
static const uint8_t MISO = 12;
static const uint8_t SCK = 13;

static const uint8_t SDA = 18;
static const uint8_t SCL = 19;


static const uint8_t A0 = 14;
static const uint8_t A1 = 15;
static const uint8_t A2 = 16;
static const uint8_t A3 = 17;
static const uint8_t A4 = 18;
static const uint8_t A5 = 19;
static const uint8_t A6 = 20;
static const uint8_t A7 = 21;
# 248 "/Users/billw/Library/Arduino15/packages/arduino/hardware/avr/1.6.2/cores/arduino/Arduino.h" 2
# 24 "/Users/billw/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.h" 2
# 44 "/Users/billw/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.h"
class Adafruit_NeoPixel {

 public:


  Adafruit_NeoPixel(uint16_t n, uint8_t p=6, uint8_t t=0x01 + 0x02);
  ~Adafruit_NeoPixel();

  void
    begin(void),
    show(void),
    setPin(uint8_t p),
    setPixelColor(uint16_t n, uint8_t r, uint8_t g, uint8_t b),
    setPixelColor(uint16_t n, uint32_t c),
    setBrightness(uint8_t),
    clear();
  uint8_t
   *getPixels(void) const,
    getBrightness(void) const;
  uint16_t
    numPixels(void) const;
  static uint32_t
    Color(uint8_t r, uint8_t g, uint8_t b);
  uint32_t
    getPixelColor(uint16_t n) const;
  inline bool
    canShow(void) { return (micros() - endTime) >= 50L; }

 private:

  const uint16_t
    numLEDs,
    numBytes;
  uint8_t
    pin,
    brightness,
   *pixels,
    rOffset,
    gOffset,
    bOffset;
  const uint8_t
    type;
  uint32_t
    endTime;

  const volatile uint8_t
    *port;
  uint8_t
    pinMask;


};
# 7 "oiOSoul.ino" 2





void setup();
void loop();
void sneeze();
void doseOff();
void move3Servos(Servo servo1Name, float target_pos1,Servo servo2Name, float target_pos2,Servo servo3Name, float target_pos3,float easing);
void rainbow(uint8_t wait);
void rainbowCycle(uint8_t wait);
void theaterChase(uint32_t c, uint8_t wait);
void theaterChaseRainbow(uint8_t wait);
uint32_t Wheel(byte WheelPos);
void dimmer(int a, int b, int red, int green, int blue,int fadeDirection, int stepSpeed);
void setEyesColor(uint32_t color);
# 11 "oiOSoul.ino"
Adafruit_NeoPixel strip = Adafruit_NeoPixel(2, 12, 0x01 + 0x02);


uint32_t black = strip.Color(0, 0, 0);
uint32_t white = strip.Color(255, 255, 255);
uint32_t magenta = strip.Color(255, 0, 255);
uint32_t red = strip.Color(255, 0, 0);
uint32_t green = strip.Color(0, 255, 0);
uint32_t blue = strip.Color(0, 0, 255);
uint32_t blueMar = strip.Color(0, 157, 255);
uint32_t orange = strip.Color(250, 175, 0);
uint32_t yellow = strip.Color(255, 255, 0);
uint32_t nightBlue = strip.Color(35, 0, 135);




Servo servoLeg;
Servo servoWaste;
Servo servoHead;




int centerLeg=1580;
int leftLeg=2300;
int rightLeg=670;

int centerWaste=1300;
int forwardWaste=1670;
int backwardWaste=777;

int centerHead=1150;
int leftHead=2400;
int rightHead=600;



int sensor;
long unsigned detectionTime = 0;
long unsigned prevDetectionTime = 0;
int detectionCountFast = 0;
int detectionCountSlow = 0;
int fastDetection = 7000;
boolean proxDetected = false;



int sound;
float rhythm = 0.3;
int countOfDetectedBeats = 0;
long unsigned lastBeat = 0;
int allowedPauseBetweenSequences = 2000;


long unsigned lastAction = 0;
int sneezeTimer = 65000;
int sleepIfNoActionTimer = 45000;

void setup() {





   servoLeg.attach(3);
   servoWaste.attach(5);
   servoHead.attach(6);


   pinMode(8, 0x0);



   servoLeg.writeMicroseconds(centerLeg);
   servoWaste.writeMicroseconds(centerWaste);
   servoHead.writeMicroseconds(centerHead);
   delay(1000);

   strip.begin();
   strip.setBrightness(180);
   strip.show();
   setEyesColor(white);


}

void loop() {


sensor = analogRead(A0);
sound = digitalRead(8);




if((millis() - lastAction) > sleepIfNoActionTimer) {
  doseOff();
}


if(millis() % sneezeTimer == 0) {
  sneeze();
}
# 127 "oiOSoul.ino"
if (sound == 0x1) {
    delay(100);
    if (sound == 0x1) {

      lastBeat = millis();
      int x = random(1,5);





      switch(x){
        case 1:
        setEyesColor(magenta);
        move3Servos(servoLeg,centerLeg,servoWaste,1350,servoHead,1650,rhythm);
        move3Servos(servoLeg,centerLeg,servoWaste,centerWaste,servoHead,centerHead,rhythm);
        break;

        case 2:
        setEyesColor(blue);
        move3Servos(servoLeg,centerLeg,servoWaste,1350,servoHead,800,rhythm);
        move3Servos(servoLeg,centerLeg,servoWaste,centerWaste,servoHead,centerHead,rhythm);
        break;

        case 3:
        setEyesColor(red);
        move3Servos(servoLeg,1320,servoWaste,centerWaste,servoHead,800,0.5);
        move3Servos(servoLeg,centerLeg,servoWaste,centerWaste,servoHead,centerHead,rhythm);
        break;

        case 4:
        setEyesColor(yellow);
        move3Servos(servoLeg,1900,servoWaste,centerWaste,servoHead,1800,rhythm);
        move3Servos(servoLeg,centerLeg,servoWaste,centerWaste,servoHead,centerHead,rhythm);
        break;

      }
  setEyesColor(white);
  countOfDetectedBeats++;
  lastAction = millis();
  }
}

if((millis()-lastBeat) > allowedPauseBetweenSequences && countOfDetectedBeats >=4 && countOfDetectedBeats <= 10)
{
  rhythm = 0.5;
  setEyesColor(red);
  move3Servos(servoLeg,1700,servoWaste,1350,servoHead,1580,0.1);
  delay(1000);
  setEyesColor(black);
  delay(80);
  setEyesColor(red);
  delay(700);
  setEyesColor(black);
  delay(80);
  setEyesColor(red);
  lastBeat = millis();
  countOfDetectedBeats = 0;
  lastAction = millis();
}

 if(countOfDetectedBeats > 10)
  {
   for(int i=1;i<=8;i++)
    {
      move3Servos(servoLeg,centerLeg,servoWaste,1350,servoHead,1650,rhythm);
      move3Servos(servoLeg,centerLeg,servoWaste,centerWaste,servoHead,centerHead,rhythm);
    }
   move3Servos(servoLeg,centerLeg,servoWaste,1100,servoHead,centerHead,0.3);
   delay(1000);
   move3Servos(servoLeg,centerLeg,servoWaste,1100,servoHead,1580,0.08);
   delay(2000);
   setEyesColor(orange);
   move3Servos(servoLeg,1000,servoWaste,1600,servoHead,750,5.0);
   delay(1000);
   move3Servos(servoLeg,1000,servoWaste,1600,servoHead,2200,0.05);
   delay(600);
   move3Servos(servoLeg,1000,servoWaste,1600,servoHead,750,0.2);
   countOfDetectedBeats = 0;
   rhythm = 0.3;
   lastBeat = 0;
   detectionCountFast = 1;
   detectionCountSlow = 1;
   lastAction = millis();
  }
# 230 "oiOSoul.ino"
if(sensor < 250)
  {
  delay(150);
  if(sensor < 250)
  {

    detectionTime = millis();
    if (detectionCountFast !=0)
    {
      if (detectionTime-prevDetectionTime < fastDetection )
        {
        detectionCountFast++;
        detectionCountSlow = 1;
        }
      else
        {
        detectionCountSlow++;
        detectionCountFast = 1;
        }
    }
    else
    {
    detectionCountFast++;
    detectionCountSlow++;
    }
    if(detectionCountFast > 3) detectionCountFast=1;
    if(detectionCountSlow > 3) detectionCountSlow=1;


    prevDetectionTime = detectionTime;
    proxDetected = true;







  }
}




if(proxDetected == true && detectionCountFast == 1 && detectionCountSlow == 1)
  {
    setEyesColor(white);

    int x = random(1,2);
    if(x == 2)
    {
      move3Servos(servoLeg,centerLeg,servoWaste,1000,servoHead,centerHead,0.05);
      delay(1000);
      move3Servos(servoLeg,centerLeg,servoWaste,centerWaste,servoHead,centerHead,0.05);
    }
    else
    {
      move3Servos(servoLeg,1850,servoWaste,1000,servoHead,centerHead,0.05);
      delay(1000);
      move3Servos(servoLeg,centerLeg,servoWaste,centerWaste,servoHead,centerHead,0.05);
    }
    proxDetected = false;
    lastAction = millis();
  }
  else if (proxDetected == true && detectionCountFast == 2 && detectionCountSlow == 1)
  {
    setEyesColor(orange);
    move3Servos(servoLeg,1700,servoWaste,900,servoHead,centerHead,0.05);
    delay(1000);
    move3Servos(servoLeg,centerLeg,servoWaste,centerWaste,servoHead,centerHead,0.08);
    proxDetected = false;
    lastAction = millis();
  }
  else if(proxDetected == true && detectionCountFast == 3 && detectionCountSlow == 1)
  {
  setEyesColor(red);
  move3Servos(servoLeg,centerLeg,servoWaste,800,servoHead,1580,0.08);
  move3Servos(servoLeg,centerLeg,servoWaste,800,servoHead,730,0.3);
  move3Servos(servoLeg,centerLeg,servoWaste,800,servoHead,1580,0.3);
  move3Servos(servoLeg,centerLeg,servoWaste,800,servoHead,centerHead,0.3);
  delay(1000);
  move3Servos(servoLeg,centerLeg,servoWaste,centerWaste,servoHead,centerHead,0.05);
  dimmer(10,255,255,0,0,3,3);
  dimmer(10,255,255,0,0,3,3);
  delay(2000);
  setEyesColor(white);
  proxDetected = false;
  lastAction = millis();
  }
  else if(proxDetected == true && detectionCountFast == 1 && detectionCountSlow == 2)
  {
  setEyesColor(magenta);
  delay(500);
  move3Servos(servoLeg,centerLeg,servoWaste,1500,servoHead,centerHead,0.03);
  move3Servos(servoLeg,centerLeg,servoWaste,1300,servoHead,1580,0.05);
  move3Servos(servoLeg,centerLeg,servoWaste,centerWaste,servoHead,750,0.05);
  move3Servos(servoLeg,1100,servoWaste,centerWaste,servoHead,1900,0.5);
  delay(1000);
  setEyesColor(black);
  delay(100);
  setEyesColor(magenta);
  delay(800);
  setEyesColor(black);
  delay(80);
  setEyesColor(magenta);
  delay(2000);
  proxDetected = false;
  lastAction = millis();
  }

  else if(proxDetected == true && detectionCountFast == 1 && detectionCountSlow == 3)
  {
  setEyesColor(yellow);
  move3Servos(servoLeg,centerLeg,servoWaste,centerWaste,servoHead,centerHead,0.05);
  move3Servos(servoLeg,670,servoWaste,centerWaste,servoHead,2300,0.09);
  move3Servos(servoLeg,2300,servoWaste,centerWaste,servoHead,600,0.09);
  delay(1000);
  move3Servos(servoLeg,2300,servoWaste,800,servoHead,600,0.05);
  move3Servos(servoLeg,2300,servoWaste,1250,servoHead,600,0.05);
  delay(700);
  setEyesColor(blueMar);
  move3Servos(servoLeg,centerLeg,servoWaste,centerWaste,servoHead,centerHead,0.05);
  move3Servos(servoLeg,2300,servoWaste,centerWaste,servoHead,600,0.1);
  move3Servos(servoLeg,670,servoWaste,centerWaste,servoHead,2300,0.1);
  delay(1000);
  move3Servos(servoLeg,centerLeg,servoWaste,centerWaste,servoHead,centerHead,0.05);
  rainbow(20);
  move3Servos(servoLeg,centerLeg,servoWaste,1520,servoHead,centerHead,0.01);
  setEyesColor(white);
  proxDetected = false;
  lastAction = millis();
  }
# 370 "oiOSoul.ino"
}





void sneeze()
{
move3Servos(servoLeg,centerLeg,servoWaste,900,servoHead,centerHead,0.04);
setEyesColor(black);
move3Servos(servoLeg,centerLeg,servoWaste,1500,servoHead,centerHead,0.3);
move3Servos(servoLeg,centerLeg,servoWaste,1150,servoHead,centerHead,0.3);
rainbowCycle(2);
move3Servos(servoLeg,centerLeg,servoWaste,centerWaste,servoHead,centerHead,0.05);
setEyesColor(white);
}

void doseOff()
{
dimmer(10,255,35,0,135,2,25);
move3Servos(servoLeg,centerLeg,servoWaste,1400,servoHead,centerHead,2.0);
delay(1500);
move3Servos(servoLeg,centerLeg,servoWaste,1700,servoHead,1000,2.0);
delay(1500);
move3Servos(servoLeg,centerLeg,servoWaste,1850,servoHead,1000,2.0);
delay(4000);
move3Servos(servoLeg,centerLeg,servoWaste,1070,servoHead,centerHead,0.1);

setEyesColor(black);
delay(500);
setEyesColor(nightBlue);
delay(500);
move3Servos(servoLeg,centerLeg,servoWaste,1070,servoHead,1000,0.08);
setEyesColor(black);
delay(300);
setEyesColor(nightBlue);
delay(300);
move3Servos(servoLeg,centerLeg,servoWaste,1070,servoHead,centerHead,0.08);
setEyesColor(black);
delay(200);
setEyesColor(nightBlue);
delay(5000);
move3Servos(servoLeg,1200,servoWaste,1060,servoHead,1500,0.02);
dimmer(10,255,35,0,135,2,25);
setEyesColor(black);
move3Servos(servoLeg,1200,servoWaste,1400,servoHead,1500,3.0);
delay(1500);
move3Servos(servoLeg,1200,servoWaste,1600,servoHead,1500,3.0);
delay(1500);

for(int i=1600;i<=2300;i+=2){
servoWaste.writeMicroseconds(i);
delay(100);
}
setEyesColor(black);
  while(true){
    sound = digitalRead(8);
    if (sound == 0x1)
    {
    delay(100);
      if (sound == 0x1) {
      move3Servos(servoLeg,centerLeg,servoWaste,1070,servoHead,centerHead,0.1);
      rainbowCycle(5);
      break;
      }
    }

  }
}



void move3Servos(Servo servo1Name, float target_pos1,Servo servo2Name, float target_pos2,Servo servo3Name, float target_pos3,float easing){







    target_pos1 = ((target_pos1)<(600)?(600):((target_pos1)>(2400)?(2400):(target_pos1)));
    target_pos2 = ((target_pos2)<(600)?(600):((target_pos2)>(2400)?(2400):(target_pos2)));
    target_pos3 = ((target_pos3)<(600)?(600):((target_pos3)>(2400)?(2400):(target_pos3)));

    easing = ((easing)<(0.0)?(0.0):((easing)>(5.0)?(5.0):(easing)));


   float current_pos1 = servo1Name.readMicroseconds();
   float current_pos2 = servo2Name.readMicroseconds();
   float current_pos3 = servo3Name.readMicroseconds();



   float diff1;
   float diff2;
   float diff3;

  while(true){

     diff1 = target_pos1 - current_pos1;
     diff2 = target_pos2 - current_pos2;
     diff3 = target_pos3 - current_pos3;


     if( fabs(diff1) > 5.0 ) {
       if(easing <= 1.00) current_pos1 += diff1 * easing;
         else {
           if(diff1 > 0.0) current_pos1 += easing;
           else current_pos1 -= easing;
       }

        servo1Name.writeMicroseconds( (int)current_pos1 );
     }
     if( fabs(diff2) > 5.0 ) {
       if(easing <= 1.00) current_pos2 += diff2 * easing;
         else {
           if(diff2 > 0.0) current_pos2 += easing;
           else current_pos2 -= easing;
       }
        servo2Name.writeMicroseconds( (int)current_pos2 );
     }
    if( fabs(diff3) > 5.0 ) {
       if(easing <= 1.00) current_pos3 += diff3 * easing;
         else {
           if(diff3 > 0.0) current_pos3 += easing;
           else current_pos3 -= easing;
       }
        servo3Name.writeMicroseconds( (int)current_pos3 );
     }

     else if(fabs(diff1)<=5.0 && fabs(diff2) <=5.0 && fabs(diff3) <=5.0){

        break;
       }


     delay(15);

  }

}







void rainbow(uint8_t wait) {
  uint16_t i, j;

  for(j=0; j<256; j++) {
    for(i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel((i+j) & 255));
    }
    strip.show();
    delay(wait);
  }
}


void rainbowCycle(uint8_t wait) {
  uint16_t i, j;

  for(j=0; j<256*5; j++) {
    for(i=0; i< strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
    }
    strip.show();
    delay(wait);
  }
}


void theaterChase(uint32_t c, uint8_t wait) {
  for (int j=0; j<10; j++) {
    for (int q=0; q < 3; q++) {
      for (int i=0; i < strip.numPixels(); i=i+3) {
        strip.setPixelColor(i+q, c);
      }
      strip.show();

      delay(wait);

      for (int i=0; i < strip.numPixels(); i=i+3) {
        strip.setPixelColor(i+q, 0);
      }
    }
  }
}


void theaterChaseRainbow(uint8_t wait) {
  for (int j=0; j < 256; j++) {
    for (int q=0; q < 3; q++) {
        for (int i=0; i < strip.numPixels(); i=i+3) {
          strip.setPixelColor(i+q, Wheel( (i+j) % 255));
        }
        strip.show();

        delay(wait);

        for (int i=0; i < strip.numPixels(); i=i+3) {
          strip.setPixelColor(i+q, 0);
        }
    }
  }
}



uint32_t Wheel(byte WheelPos) {
  if(WheelPos < 85) {
   return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  } else if(WheelPos < 170) {
   WheelPos -= 85;
   return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } else {
   WheelPos -= 170;
   return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
}

void dimmer(int a, int b, int red, int green, int blue,int fadeDirection, int stepSpeed){


switch(fadeDirection){

  case 1:
  for(int i=a;i<=b;i++){
   strip.setPixelColor(0, (i*red/255) , (i*green/255), (i*blue/255));
   strip.setPixelColor(1, (i*red/255) , (i*green/255), (i*blue/255));
   strip.show();
   delay(stepSpeed);
  }
  break;

  case 2:
  for(int i=b;i>=a;i--){
  strip.setPixelColor(0, (i*red/255) , (i*green/255), (i*blue/255));
  strip.setPixelColor(1, (i*red/255) , (i*green/255), (i*blue/255));
  strip.show();
  delay(stepSpeed);
  }
  break;

  case 3:
  for(int i=a;i<=b;i++){
   strip.setPixelColor(0, (i*red/255) , (i*green/255), (i*blue/255));
   strip.setPixelColor(1, (i*red/255) , (i*green/255), (i*blue/255));
   strip.show();
   delay(stepSpeed);
  }
  for(int i=b;i>=a;i--){
  strip.setPixelColor(0, (i*red/255) , (i*green/255), (i*blue/255));
  strip.setPixelColor(1, (i*red/255) , (i*green/255), (i*blue/255));
  strip.show();
  delay(stepSpeed);
  }
  break;

}
}

void setEyesColor(uint32_t color)
{
strip.setPixelColor(0,color);
strip.setPixelColor(1,color);
strip.show();
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.