Hey,
I am trying to use a library for a few days, but it does not run.
I am using Arduino 1.0.6. and an Arduino Uno R3.
The library (stored in ...\Documents\Arduino\libraries\LEDTools):
#ifndef LEDTools_h
#define LEDTools_h
#include <Arduino.h>
class LEDTools {
public:
void rgbToHsv(unsigned char r, unsigned char g, unsigned char b);
};
#include "LEDTools.h"
void LEDTools::rgbToHsv(unsigned char r, unsigned char g, unsigned char b) {
double rd = (double) r/255;
double gd = (double) g/255;
double bd = (double) b/255;
double max = max(rd, max(gd, bd)), min = min(rd, min(gd, bd));
double h, s, v = max;
double d = max - min;
s = max == 0 ? 0 : d / max;
if (max == min) {
h = 0;
} else {
if (max == rd) {
h = (gd - bd) / d + (gd < bd ? 6 : 0);
} else if (max == gd) {
h = (bd - rd) / d + 2;
} else if (max == bd) {
h = (rd - gd) / d + 4;
}
h /= 6;
}
}
Arduino Code:
#include <LEDTools.h>
void setup() {
// put your setup code here, to run once:
}
byte r,b,g = 1;
void loop() {
rgbToHsv( r, b, g );
}
Error message:
test.ino: In function 'void loop()':
test:11: error: 'rgbToHsv' was not declared in this scope
Please, help me