Pages: [1]   Go Down
Author Topic: BiColor LED errors  (Read 767 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
Eureka does not mean what you think.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello!
I tried to build both examples for the BiColor LED example set found here http://arduino.cc/playground/Code/BiColorLED

I received this error message:
Code:
C:\Users\GCL\Documents\Arduino\libraries\BiColorLED/BiColorLED.h:24: note:                 BiColorLED::BiColorLED(const BiColorLED&)
BiColorLED.cpp: In function 'void loop()':
BiColorLED.pde:-1: error: 'class BiColorLED' has no member named 'getColor'

And it first surfaced with this one:
Code:
#include <BiColorLED.h>

// Simple demo of features available in V1.0 of the BiColorLED library
// (C) 2012 Wolfgang Faust

// To see the effects of this example, just plug a bi-color LED
// into pins 4 and 5, along with the appropriate resistors.

BiColorLED led=BiColorLED(4,5); // (pin 1, pin 2)
unsigned long time; // Time the colour was last changed

void setup() {
  // BiColorLED doesn't need anything here
}

void loop() {
  // Change the colour once each second; Order: 1, 3, 2
  if (millis()-time > 1000) {
    int color=led.getColor();
    if (color == 1) {
      color=3;
    } else if (color == 3) {
      color=2;
    } else if (color == 2) {
      color=1;
    } else { // Starts at 0, or in case anything bizzarre happens to the color var
      color=1;
    }
    led.setColor(color);
    time=millis(); // Keep track of time of colour change.
  }
  // led.drive() MUST be called frequently (at least once every 10 ms)
  // for the yellow to work. Otherwise, it will just stay red or green.
  // This means that you should avoid calling delay().
  // Before 10ms, there is no flicker visible
  // At ~10ms, there is a barely noticible `jitter'
  // At ~15ms, the flickering is quite obvious.
  led.drive();
}

Oddly enough the errors also repeated themselves here:
Code:
#include <BiColorLED.h>

// Simple demo of blinking using BiColorLED library
// Requires v1.1 or greater
// (C) 2012 Wolfgang Faust

// To see the effects of this example, just plug a bi-color LED
// into pins 4 and 5, along with the appropriate resistors.

BiColorLED led=BiColorLED(4,5); // (pin 1, pin 2)
unsigned long lb; // Time the colour was last changed

void setup() {
  Serial.begin(9600);
  led.setColor(1);
  led.setColor2(2);
  led.setBlinkSpeed(1000);
}

void loop() {
  // led.drive() MUST be called for blinking (and yellow) to work.
  led.drive();
  if (lb != led.lastBlink) {
    Serial.print(led.blinkSpeed);
    Serial.print(":");
    Serial.println(led.lastBlink);
    lb=led.lastBlink;
  }
}

To be honest this is the first time I've seen that error before and I've got no idea what did cause it. I might add I just returned to the Arduino from a long absence and am pleased to see the arrival of version 1.01 of the IDE.

Update: I've tried it on the earlier releases. And it seems that on most of them they seem to work, I did get interesting errors on one but not the other.
« Last Edit: November 06, 2012, 02:24:31 pm by doctorwho8 » Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 212
Posts: 8970
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

In BiColorLED.h change Wprogram.h to Arduino.h to work with Ardiuno 1.0
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Pages: [1]   Go Up
Jump to: