What kind of codes should be burned to uno to use simplefocstudio?

I have a arduino uno and simplefoc shield v2.0.4. But I have no idea what to burn to the arduino.
I have tried the code below but exceeded the size of flash memory:

#include <SimpleFOC.h>

// BLDC motor & driver instance
BLDCMotor motor = BLDCMotor(7);
// driver
BLDCDriver3PWM driver = BLDCDriver3PWM(9, 5, 6, 8);
// encoder instance
MagneticSensorSPI encoder = MagneticSensorSPI(AS5048_SPI, 10);
// current sense
InlineCurrentSense current_sense = InlineCurrentSense(0.01f, 50.0f, A0, A2);

// include commander interface
Commander command = Commander(Serial);
void doMotor(char* cmd) { command.motor(&motor, cmd); }

void setup(){
    Serial.begin(115200);
    // SimpleFOCDebug::enable(&Serial);

    encoder.init();
    motor.linkSensor(&encoder);

    driver.voltage_power_supply = 12;  
    driver.init();                     
    motor.linkDriver(&driver);
    current_sense.linkDriver(&driver);
    current_sense.init();
    motor.linkCurrentSense(&current_sense);
    motor.init();          
    motor.initFOC();       

    command.add('M',doMotor,'motor');
    // tell the motor to use the monitoring
    motor.useMonitoring(Serial);
    motor.monitor_downsample = 0; // disable monitor at first - optional

}
void loop(){
    motor.loopFOC();       
    motor.move();          
    // real-time monitoring calls
    motor.monitor();
    // real-time commander calls
    command.run();
}

Unfortunately the UNO is quite an old MCU with limited speed and memory…

I think your options are:

  • Reduce the code in some way - usually removing Commander will make it fit

  • Switch to a more powerful MCU

thank you very much :melting_face: