Go Down

Topic: BiColor LED errors (Read 783 times) previous topic - next topic

doctorwho8

Nov 06, 2012, 07:47 pm Last Edit: Nov 06, 2012, 08:24 pm by doctorwho8 Reason: 1
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: [Select]

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: [Select]

#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: [Select]

#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.

johnwasser

In BiColorLED.h change Wprogram.h to Arduino.h to work with Ardiuno 1.0
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Go Up