I am trying to understand the library TMCSerial on Github from bread-wolf and get it to work for the TMC7300.
My code, after putting all the .h and .cpp files in the folder, looks like this:
#include"TMCSerial.hpp"
#include"TMCField.hpp"
TMCSerial TMC7300(Serial, 115200, 0);
void setup() {
TMC7300.begin();
/* Use the external capacitor mode for TMC7300 */
TMC7300.writeField(TMC7300_EXTCAP, 1);
}
void loop() {
/* Check if driver is in error state */
if (TMC7300.readField(TMC7300_DRV_ERR) == 1)
{
/* Do something... */
TMC7300.writeField(TMC7300_PWM_A, 125); // drive Motor A 50% forward
}
}
But I get the error: 'TMC7300_EXTCAP' was not declared in this scope
Then I found this part in the TMC7300_Register.h file.
So I included the following line (and also the TMC7300_Registers.h file) :
#include"TMC7300_Registers.h"
But I get the same Error message.
I am not sure if I have understood the issue with the classes and .cpp .hpp files correctly?
To understand, I just need a simple way to make one of the two motors from the TMC7300 turn at one speed.
Installing libraries into the IDE world needs to be done in a certain way. Copying those files might not be be way. I made mistakes when I first dived into that jungle.
Maybe You can find help within the IDE, how to download libraries. Else, the best I can tell is Google on "Arduino + libraries".
Thank you very much for your advice.
I had also initially tried to install the zip file TMCSerial and TMCField as libraries via zip. This worked without an error message.
However, the same error message appears here.
Therefore I tried to follow the instructions on bread-wolf's Github page.
So my guess is that I am using the wrong declaration of classes or objects here, even though I followed the instructions on bread-wolf's github page in terms of the C++ code.
Do they refer to the Arduino IDE?
I've never seen any include of hpp, or cpp files in the IDE environment.
Facing a zipped library it needs unpacking and after that an installation to the IDE library folder. I'm likely wrong on some point but as a brief description, I think it might give You some aha.