Thanks in advance! I'm extremely new to Arduino and Clearcore, with little to no programing experience(this means I have none). Short story on the scope of project - Servo mounted to a rotary table, controlled by manual buttons such as Jog CW, Jog CCW, Rapid CW... you get the idea. Basically a power feed for a rotary table. I can get the IDE to talk to the Clearcore using teknic's built in example of writedigitaloutput, it will then change the LED flashing pattern. Any code after that will not work, and I get a similar error. This code is from ChatGPT, just an example of code with the corresponding error. I get this error while trying to verify. Please let me know what I'm missing here, I'm sure I've overlooked something. Thanks again!
The Clearcore is an IO expansion and motion controller that works in addition to the Teknic servo with built in controller. The Clearcore can be programmed with C++ or Arduino code, with their Arduino wrapper and Arduino IDE.
As of now there is no wiring schematic involved, the Clearcore is connected to the computer via USB.
Here are some links about the Clearcore and information they have provided about programing with Arduino.
https://teknic.com/
https://teknic.com/products/io-motion-controller/
https://teknic-inc.github.io/ClearCore-library/ArduinoRef.html
#include <Servo.h>
Servo myservo; // Create a Servo object
int speed = 100; // Desired rotation speed in rpm
int servoDirection = 1; // 1 for CCW, -1 for CW
int buttonPin = 2; // Connect your button to digital pin 2
int buttonState = 0;
int lastButtonState = 0;
void setup() {
myservo.attach(9); // Attach the servo to pin 9
myservo.writeMicroseconds(1500); // Set the initial position (1500 is the stop position for a modified servo)
pinMode(buttonPin, INPUT);
lastButtonState = digitalRead(buttonPin);
}
void loop() {
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH && lastButtonState == LOW) {
// Button has been pressed, toggle the servo direction
servoDirection = -servoDirection;
}
lastButtonState = buttonState;
// Calculate the angle increment based on speed (in degrees per second)
float angleIncrement = 6.0 * speed / 60.0 * servoDirection;
// Move the servo by the calculated angle increment
myservo.write(myservo.read() + angleIncrement);
delay(20); // Adjust the delay to control the rotation speed
}
Here's the error
C:\Users\freda\AppData\Local\Arduino15\libraries\Servo\src\sam\Servo.cpp: In function 'void Servo_Handler(timer16_Sequence_t, Tc*, uint8_t)':
C:\Users\freda\AppData\Local\Arduino15\libraries\Servo\src\sam\Servo.cpp:79:9: error: 'union Tc' has no member named 'TC_CHANNEL'
tc->TC_CHANNEL[channel].TC_SR;
^~~~~~~~~~
C:\Users\freda\AppData\Local\Arduino15\libraries\Servo\src\sam\Servo.cpp:81:13: error: 'union Tc' has no member named 'TC_CHANNEL'
tc->TC_CHANNEL[channel].TC_CCR |= TC_CCR_SWTRG; // channel set to -1 indicated that refresh interval completed so reset the timer
^~~~~~~~~~
C:\Users\freda\AppData\Local\Arduino15\libraries\Servo\src\sam\Servo.cpp:81:43: error: 'TC_CCR_SWTRG' was not declared in this scope
tc->TC_CHANNEL[channel].TC_CCR |= TC_CCR_SWTRG; // channel set to -1 indicated that refresh interval completed so reset the timer
^~~~~~~~~~~~
C:\Users\freda\AppData\Local\Arduino15\libraries\Servo\src\sam\Servo.cpp:81:43: note: suggested alternative: 'TCC1_SWAP'
tc->TC_CHANNEL[channel].TC_CCR |= TC_CCR_SWTRG; // channel set to -1 indicated that refresh interval completed so reset the timer
^~~~~~~~~~~~
TCC1_SWAP
C:\Users\freda\AppData\Local\Arduino15\libraries\Servo\src\sam\Servo.cpp:90:13: error: 'union Tc' has no member named 'TC_CHANNEL'
tc->TC_CHANNEL[channel].TC_RA = tc->TC_CHANNEL[channel].TC_CV + SERVO(timer,Channel[timer]).ticks;
^~~~~~~~~~
C:\Users\freda\AppData\Local\Arduino15\libraries\Servo\src\sam\Servo.cpp:90:45: error: 'union Tc' has no member named 'TC_CHANNEL'
tc->TC_CHANNEL[channel].TC_RA = tc->TC_CHANNEL[channel].TC_CV + SERVO(timer,Channel[timer]).ticks;
^~~~~~~~~~
C:\Users\freda\AppData\Local\Arduino15\libraries\Servo\src\sam\Servo.cpp:97:18: error: 'union Tc' has no member named 'TC_CHANNEL'
if( (tc->TC_CHANNEL[channel].TC_CV) + 4 < usToTicks(REFRESH_INTERVAL) ) { // allow a few ticks to ensure the next OCR1A not missed
^~~~~~~~~~
C:\Users\freda\AppData\Local\Arduino15\libraries\Servo\src\sam\Servo.cpp:98:17: error: 'union Tc' has no member named 'TC_CHANNEL'
tc->TC_CHANNEL[channel].TC_RA = (unsigned int)usToTicks(REFRESH_INTERVAL);
^~~~~~~~~~
C:\Users\freda\AppData\Local\Arduino15\libraries\Servo\src\sam\Servo.cpp:101:17: error: 'union Tc' has no member named 'TC_CHANNEL'
tc->TC_CHANNEL[channel].TC_RA = tc->TC_CHANNEL[channel].TC_CV + 4; // at least REFRESH_INTERVAL has elapsed
^~~~~~~~~~
C:\Users\freda\AppData\Local\Arduino15\libraries\Servo\src\sam\Servo.cpp:101:49: error: 'union Tc' has no member named 'TC_CHANNEL'
tc->TC_CHANNEL[channel].TC_RA = tc->TC_CHANNEL[channel].TC_CV + 4; // at least REFRESH_INTERVAL has elapsed
^~~~~~~~~~
C:\Users\freda\AppData\Local\Arduino15\libraries\Servo\src\sam\Servo.cpp: In function 'void _initISR(Tc*, uint32_t, uint32_t, IRQn_Type)':
C:\Users\freda\AppData\Local\Arduino15\libraries\Servo\src\sam\Servo.cpp:109:5: error: 'pmc_enable_periph_clk' was not declared in this scope
pmc_enable_periph_clk(id);
^~~~~~~~~~~~~~~~~~~~~
C:\Users\freda\AppData\Local\Arduino15\libraries\Servo\src\sam\Servo.cpp:111:4: error: 'TC_CMR_TCCLKS_TIMER_CLOCK3' was not declared in this scope
TC_CMR_TCCLKS_TIMER_CLOCK3 | // MCK/32
^~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\freda\AppData\Local\Arduino15\libraries\Servo\src\sam\Servo.cpp:112:13: error: 'TC_CMR_WAVE' was not declared in this scope
TC_CMR_WAVE | // Waveform mode
^~~~~~~~~~~
C:\Users\freda\AppData\Local\Arduino15\libraries\Servo\src\sam\Servo.cpp:112:13: note: suggested alternative: 'REG_TCC1_WAVE'
TC_CMR_WAVE | // Waveform mode
^~~~~~~~~~~
REG_TCC1_WAVE
C:\Users\freda\AppData\Local\Arduino15\libraries\Servo\src\sam\Servo.cpp:113:13: error: 'TC_CMR_WAVSEL_UP_RC' was not declared in this scope
TC_CMR_WAVSEL_UP_RC ); // Counter running up and reset when equals to RC
^~~~~~~~~~~~~~~~~~~
C:\Users\freda\AppData\Local\Arduino15\libraries\Servo\src\sam\Servo.cpp:113:13: note: suggested alternative: 'TCC_WAVE_POL0'
TC_CMR_WAVSEL_UP_RC ); // Counter running up and reset when equals to RC
^~~~~~~~~~~~~~~~~~~
TCC_WAVE_POL0
C:\Users\freda\AppData\Local\Arduino15\libraries\Servo\src\sam\Servo.cpp:110:5: error: 'TC_Configure' was not declared in this scope
TC_Configure(tc, channel,
^~~~~~~~~~~~
C:\Users\freda\AppData\Local\Arduino15\libraries\Servo\src\sam\Servo.cpp:116:5: error: 'TC_SetRA' was not declared in this scope
TC_SetRA(tc, channel, 2625); // 1ms
^~~~~~~~
C:\Users\freda\AppData\Local\Arduino15\libraries\Servo\src\sam\Servo.cpp:121:9: error: 'union Tc' has no member named 'TC_CHANNEL'
tc->TC_CHANNEL[channel].TC_IER = TC_IER_CPAS;
^~~~~~~~~~
C:\Users\freda\AppData\Local\Arduino15\libraries\Servo\src\sam\Servo.cpp:121:38: error: 'TC_IER_CPAS' was not declared in this scope
tc->TC_CHANNEL[channel].TC_IER = TC_IER_CPAS;
^~~~~~~~~~~
C:\Users\freda\AppData\Local\Arduino15\libraries\Servo\src\sam\Servo.cpp:121:38: note: suggested alternative: 'ICM_IER_MASK'
tc->TC_CHANNEL[channel].TC_IER = TC_IER_CPAS;
^~~~~~~~~~~
ICM_IER_MASK
C:\Users\freda\AppData\Local\Arduino15\libraries\Servo\src\sam\Servo.cpp:124:5: error: 'TC_Start' was not declared in this scope
TC_Start(tc, channel);
^~~~~~~~
C:\Users\freda\AppData\Local\Arduino15\libraries\Servo\src\sam\Servo.cpp: In function 'void finISR(timer16_Sequence_t)':
C:\Users\freda\AppData\Local\Arduino15\libraries\Servo\src\sam\Servo.cpp:154:5: error: 'TC_Stop' was not declared in this scope
TC_Stop(TC_FOR_TIMER1, CHANNEL_FOR_TIMER1);
^~~~~~~
exit status 1
Compilation error: exit status 1