Hello everyone.
I'm really stumped - I'm having this really strange problem when I try to create an Arduino library.
I have a header file - MpptLib.h - and a .cpp file - MpptLib.cpp.
My top-level design file is called "Manager." It uses the functions in the MpptLib library.
So, the weird problem:
I try to create an instance of the class MpptLib, called mpptlib. Then, I try to call the function read_data() in mpptlib.
So I type:
MpptLib mpptlib();
mpptlib.read_data();
BUT, even though I haven't even hit "Verify" and tried to compile, the software freaks out. The line "mpptlib.read_data();" and everything below it disappears, and I get a constant flow of error messages.
Here are just a few of them:
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 11
at processing.app.syntax.JEditTextArea._offsetToX(JEditTextArea.java:552)
at processing.app.syntax.JEditTextArea.scrollTo(JEditTextArea.java:447)
at processing.app.syntax.JEditTextArea.scrollToCaret(JEditTextArea.java:412)
at processing.app.syntax.JEditTextArea.select(JEditTextArea.java:1177)
at processing.app.syntax.JEditTextArea$DocumentHandler.removeUpdate(JEditTextArea.java:1993)
at javax.swing.text.AbstractDocument.fireRemoveUpdate(AbstractDocument.java:242)
at processing.app.syntax.SyntaxDocument.fireRemoveUpdate(SyntaxDocument.java:164)
at javax.swing.text.AbstractDocument.handleRemove(AbstractDocument.java:607)
As soon as I backspace on the line mpptlib.read_data(), the error messages stop coming.
The code for my Manager file (the file that uses the MpptLib library) is:
//Manager - Top-Level
//April 1, 2010
#include "MpptLib.h"
void setup()
{
Serial.begin(9600); //Open serial port
}
void loop()
{
MpptLib mpptlib();
mpptlib.read_data(); //(I can't actually type this line without the software freaking out)
}
Could someone please help me out? I'm pretty new to OOP and completely new to C++.
Thanks so much!