Hi guys, while I’ve played around with Arduino’s and Raspberry Pi’s, I’m new with interfacing the Particle Electron with breakout boards. I’ve tried looking around this forum and tried several code examples to similar boards, but i’m not having any luck.
I’m trying to turn on my DC motor when my accelerometer/gyro (MPU6050) is at a certain angle. I have the accelerometer/gyro code working and have the angles calculated. However I can’t seem to get my DC motor to turn on. I read from one post that I can power the motor from the 3V3 pin, so here’s how I have my DRV8833 setup:
(Electron board pins) -> (DRV board pins)
3v3 -> VM
GND -> GND
A4 -> AIN1
A5 -> AIN2
(DRV board pins) -> (DC Motor)
AOUT1 -> DC motor terminal
AOUT2 -> DC motor terminal
Am I missing some connections?
Here’s a snippet of my test code:
#define AIN_1 A4
#define AIN_2 A5void setup() {
pinMode(AIN_1, OUTPUT); //Ain1
pinMode(AIN_2, OUTPUT); //Ain2
}void loop() {
digitalWrite(AIN_2, LOW);
digitalWrite(AIN_1, HIGH);
delay(1000);digitalWrite(AIN_1, LOW);
digitalWrite(AIN_2, HIGH);
delay(1000);
}
Thanks for your time and if you have and feedback, I greatly appreciate it.