Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of analoghalls5 by
main.cpp
00001 #include "includes.h" 00002 #include "core.h" 00003 #include "sensors.h" 00004 #include "meta.h" 00005 00006 Serial *pc = new Serial(SERIAL_TX, SERIAL_RX); 00007 float test_alpha = 0; 00008 float test_beta = 0; 00009 00010 00011 float test_DtcA; 00012 float test_DtcB; 00013 float test_DtcC; 00014 00015 int main() { 00016 pc->baud(115200); 00017 pc->printf("%s\n\r", "Init Serial Comm"); 00018 00019 PositionSensor *sense_p = new AnalogHallPositionSensor(A4, A5, 0.249f, 0.497f, 0.231f, 0.499f, 200.0f); 00020 CurrentSensor *sense_ic = new AnalogCurrentSensor(A1, 0.01); 00021 CurrentSensor *sense_ib = new AnalogCurrentSensor(A2, 0.01); 00022 VoltageSensor *sense_bus = new AnalogVoltageSensor(A5, 0.01); 00023 TempSensor *sense_t_motor = new TempSensor(); 00024 TempSensor *sense_t_inverter = new TempSensor(); 00025 Throttle *throttle = new Throttle(A0, 0.5f, 3.0f); 00026 00027 PidController *pid_d = new PidController(0.1f, 0.0f, 0.0f, 1.0f, 0.0f); 00028 PidController *pid_q = new PidController (0.1f, 0.0f, 0.0f, 1.0f, 0.0f); 00029 00030 Motor *motor = new Motor(sense_ic, sense_ib, sense_p, sense_t_motor); 00031 Inverter *inverter = new Inverter(D6, D13, D3, D8, sense_bus, sense_t_inverter); 00032 User *user = new User(throttle); 00033 Modulator *modulator = new SinusoidalModulator(inverter); 00034 StatusUpdater *updater = new StatusUpdater(inverter, motor, user); 00035 LoopDriver *driver = new LoopDriver(inverter, motor, user, pid_d, pid_q, modulator, 1.0f, 5000); 00036 00037 motor->Config(4, 20.0f); 00038 updater->Config(5000, 10); 00039 00040 driver->Start(); 00041 updater->Start(); 00042 }
Generated on Fri Jul 15 2022 12:15:05 by
1.7.2
