JorgeMaker / SimpleFOCStudio

A GUI based in PyQT5 and PyQtGraph to configure and control SimpleFOC devices.
MIT License
166 stars 76 forks source link

Why can't connect the system to the studio #27

Open ErDong886 opened 1 day ago

ErDong886 commented 1 day ago

image CMD shows "Connected.." for a long while, and I don't know why.

ErDong886 commented 21 hours ago

oh I find it's because I dont burn codes to arduino uno. Can someone share codes for me to learn from? I try to burn the codes but it exceeds the flash memory of arduino uno

#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();
}
ErDong886 commented 7 hours ago

I'm not a reacher but a rookie.....