LED Chaser sketch won't compile after update to Arduino 1.6.5


a sketch working on version 1.0.5 of arduino ide no longer compile on version 1.6.5.

i'm pretty new programming/arduino thing, looks problem has library i'd added simplify chasing leds.

the sketch drives servos wings of pke meter prop (from ghostbusters} , chases leds on wings , display.  

code: [select]
#include <servo.h>
#include <chaseleds.h>
#define nacelle_rate         22    // analog input reading nacelle chase rate
#define nacelle_chase_len    8     // length of nacelle chase, 1..6
#define nacelle_min_period   25    // minimum time advance nacelle chase (milliseconds)
#define nacelle_max_period   250   // maximum time advance nacelle chase (milliseconds)
#define nacelle_dim_value    0      // value dimming previous led in chase, 0..255
// output pins use nacelle chase
boolean chaseon = false;
byte nacellechasepins[8] = {14, 15, 16, 17, 18, 19, 20, 21}; // pin 21 not connected leave blank spot in sequence
class nacellechaseleds : public chaseleds
{
public:
  nacellechaseleds(const byte *pins, int num)
    : chaseleds(pins, num, 0) {}
protected:
  void advance(byte prevpin, byte nextpin) {
    digitalwrite(previouspin(2), low);
    analogwrite(prevpin, nacelle_dim_value);
    if (chaseon)
{
    digitalwrite(nextpin, high);
}
    setadvancetime(map(analogread(nacelle_rate), 0, 1023, nacelle_min_period, nacelle_max_period));
    //digitalwrite(13, !digitalread(13)); // toggle led  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  }
};
nacellechaseleds nacellechase(nacellechasepins, nacelle_chase_len);

const int touchpinfull = 12;     // number of pushbutton pin

int touchstatefull = 0;


 
servo myservol;  // create servo object control servo
                // maximum of 8 servo objects can created
servo myservor;

void setup()
{
  myservol.attach(9);
  myservor.attach(10);
  digitalwrite(13, low); //status led off
  pinmode(14, output);  //wing led
  pinmode(15, output);  //wing led
  pinmode(16, output);  //wing led
  pinmode(17, output);  //wing led
  pinmode(18, output);  //wing led
  pinmode(19, output);  //wing led
  pinmode(20, output);  //wing led
  pinmode(13, output);       // status led
  pinmode(touchpinfull, input);
  pinmode(11, input_pullup); // pushbutton
}

void loop()
{touchstatefull = digitalread(touchpinfull);
  if (touchstatefull==low) // 12 pin low due pullup resistor - returns 0, block happens.  if returns 1 (touch pressed, pin goes high), else (full wings) happens  wings @ home, no lights
  {
    if (digitalread(11)) // 11 pin high due pullup resistor - returns 1, block happens.  if returns 0 (button pressed, pin goes low), else happens  wings @ home, no lights
  {  
    digitalwrite(13, low); //status led off
    digitalwrite(14, low);  //wing led off
    digitalwrite(15, low);  //wing led off
    digitalwrite(16, low);  //wing led off
    digitalwrite(17, low);  //wing led off
    digitalwrite(18, low);  //wing led off
    digitalwrite(19, low);  //wing led off
    digitalwrite(20, low);  //wing led off
    myservol.write(20);   // servo home position
    myservor.write(140);  // servo home position
    chaseon = false;
  }
  
  else
  {
    // pin low - returns 0 - 12 pin low due pushbutton pressed  wings half up, lights
    digitalwrite(13, high);  // status led on
    myservol.write(80);  // servo half up
    myservor.write(80);  // servo half up
    chaseon = true;
  }
  }
  
  else
  {
    // pin high - returns 1 - 12 pin high due touch pressed  wings full up, lights
    digitalwrite(13, high);  // status led on
    myservol.write(140); // servo full up
    myservor.write(20);  // servo full up
    chaseon = true;
  }
  nacellechase.loop();
}


this working fine, had update teensy 3.x libraries play audio sd card, , required updating arduino software.

after update, when attempt compile error message (i've removed of error due forum limitations):

arduino: 1.6.5 (mac os x), td: 1.25, board: "teensy 3.2 / 3.1, serial, 96 mhz optimized (overclock), english"

in file included pushbutton_dual_servos_with_chase_blink.ino:2:0:
/users/shawnm/documents/arduino/libraries/chaseleds/chaseleds.h:1:5: error: stray '\302' in program
1 /*
^
/users/shawnm/documents/arduino/libraries/chaseleds/chaseleds.h:1:5: error: stray '\240' in program
/users/shawnm/documents/arduino/libraries/chaseleds/chaseleds.h:22:4: error: stray '\302' in program
22
^
/users/shawnm/documents/arduino/libraries/chaseleds/chaseleds.h:22:4: error: stray '\240' in program
/users/shawnm/documents/arduino/libraries/chaseleds/chaseleds.h:23:4: error: stray '\302' in program
23 #ifndef chaseleds_h
^
/users/shawnm/documents/arduino/libraries/chaseleds/chaseleds.h:23:4: error: stray '\240' in program
/users/shawnm/documents/arduino/libraries/chaseleds/chaseleds.h:23:8: error: stray '#' in program
23 #ifndef chaseleds_h
^
/users/shawnm/documents/arduino/libraries/chaseleds/chaseleds.h:24:4: error: stray '\302' in program
24 #define chaseleds_h
^
/users/shawnm/documents/arduino/libraries/chaseleds/chaseleds.h:24:4: error: stray '\240' in program
/users/shawnm/documents/arduino/libraries/chaseleds/chaseleds.h:24:8: error: stray '#' in program
24 #define chaseleds_h
^
error compiling.

  this report have more information with
  "show verbose output during compilation"
  enabled in file > preferences.


i assume something's broken chaseleds library, don't know what.  the chaseleds library visible in "contributed libraries" section in "include library" pulldown.  if start new sketch, add chaseleds library, , attempt compile same error message.

this chaseleds.h code (with copyright info removed):

code: [select]
1 /*
   
   22 
   23 #ifndef chaseleds_h
   24 #define chaseleds_h
   25 
   26 #include <inttypes.h>
   27 
   28 class chaseleds
   29 {
   30 public:
   31     chaseleds(const uint8_t *pins, int num, unsigned long advancetime);
   32 
   33     void loop();
   34 
   35     unsigned long advancetime() const { return _advancetime; }
   36     void setadvancetime(unsigned long advancetime) { _advancetime = advancetime; }
   37 
   38 protected:
   39     virtual void advance(uint8_t prevpin, uint8_t nextpin);
   40     uint8_t previouspin(int n) const
   41         { return _pins[(_currentindex + _numpins - n) % _numpins]; }
   42 
   43 private:
   44     const uint8_t *_pins;
   45     int _numpins;
   46     int _currentindex;
   47     unsigned long _advancetime;
   48     unsigned long _lastchange;
   49 };
   50 
   51 #endif


this code chaseleds.cpp:

 
code: [select]
   1 /*
   
   22 
   23 #include "chaseleds.h"
   24 #if defined(arduino) && arduino >= 100
   25 #include <arduino.h>
   26 #else
   27 #include <wprogram.h>
   28 #endif
   29 
   71 chaseleds::chaseleds(const uint8_t *pins, int num, unsigned long advancetime)
   72     : _pins(pins)
   73     , _numpins(num)
   74     , _currentindex(-1)
   75     , _advancetime(advancetime)
   76     , _lastchange(millis())
   77 {
   78     (uint8_t index = 0; index < _numpins; ++index) {
   79         pinmode(_pins[index], output);
   80         digitalwrite(_pins[index], low);
   81     }
   82 }
   83 
   87 void chaseleds::loop()
   88 {
   89     if (_currentindex >= 0) {
   90         if ((millis() - _lastchange) >= _advancetime) {
   91             // advance next led in sequence.
   92             _currentindex = (_currentindex + 1) % _numpins;
   93             _lastchange += _advancetime;
   94             advance(previouspin(1), _pins[_currentindex]);
   95         }
   96     } else {
   97         // first time - light first led.
   98         _currentindex = 0;
   99         _lastchange = millis();
  100         advance(previouspin(1), _pins[_currentindex]);
  101     }
  102 }
  103 
  136 void chaseleds::advance(uint8_t prevpin, uint8_t nextpin)
  137 {
  138     digitalwrite(prevpin, low);
  139     digitalwrite(nextpin, high);
  140 }
  141 



this basis chaseleds library i'm using:

http://rweather.github.io/arduinolibs/blink_startrek.html

any appreciated.

thank you.

shawn marshall
portland, or


you need post code trying compile, too.


Arduino Forum > Using Arduino > Programming Questions > LED Chaser sketch won't compile after update to Arduino 1.6.5


arduino

Comments