Hi guys has been a while since, right? But today i’m back with a new idea for my robot which is adding laser sensors!🌟 For wall avoidance…anyway today i upgraded my PCB to the max fixed all small things that could be a problem and then tried to make the motor spin with simple FOC library but didn’t work 😭yeah didn’t :( after trying to make it work for 4hrs no wait 5hrs i decided that i will make my own thing…we will see in next episode if it will work or not…oh wait i forgot that i managed to make the motors spin without the FOC!!! which was wonderful to see🎉
the code that worked was this one:
void setup() {
ledcAttach(16, 20000, 8);
ledcAttach(17, 20000, 8);
ledcAttach(18, 20000, 8);
pinMode(33, OUTPUT);
digitalWrite(33, HIGH);
}
void loop() {
static int a = 0;
ledcWrite(16, 128 + 100 * sin(a * 0.01));
ledcWrite(17, 128 + 100 * sin(a * 0.01 + 2.09));
ledcWrite(18, 128 + 100 * sin(a * 0.01 + 4.19));
a++;
delayMicroseconds(200);
}
also i have a YT and a VID will drop soon so please be sure to sub, thx:
https://www.youtube.com/@Made-g4u