This is my first attempt to build a library for arduino. This is just an example for me to understand how to transfer values to functions in librarys on arduino. But it does not work and I do not understand why.
TESTDUINO.cpp
#include "Arduino.h"
#include "TESTDUINO.h"
void TESTDUINO::TestPrint(string w, string h){
Serial.println("TestPring#" + w + "#" + h);
}
TESTDUINO.h
#ifndef Test_h
#define Test_h
class TESTDUINO{
public:
void TestPrint(string w, string h);
};
#endif
arduino file
#include <TESTDUINO.h>
TESTDUINO testduino;
void setup() {
Serial.begin(9600);
}
void loop() {
testduino.TestPrint("200","200");
}
I am a C# Programmer and not so familiar with the C language so I'm sure I made a beginner's mistake.
String
. See also : link#include "Arduino.h"
in the h file instead of the cpp one? And of course use the capital S forString
... Anyway... This is just a test library, ok. But... I suggest you to avoid using complex types such asString
.. Fixed sized buffers (e.g.char mystring[10]
) are much better