Where is your logic/common ground? (GND on Xenon also needs to connect to GND on the driver board). Don't mix anonymous pin numbers (e.g. XENON PIN 6) and pin labels (e.g. pinMode (D6, OUTPUT)) - while both might be the same, without explicitly saying so it's mere conjecture that they actually are.
Are you using the DRV8833 chip or a breakout board - if the latter which?
How have you connected your motor?
Which motor are you using?
An error description should be more than just that. Try do discribe what you see (indicator LEDs, movement, magic smoke , ...), hear (silence, humming, whining, ...), feel (chip or motor gets hot, motor vibrates, ...)
The motor does not make any kind of sounds. But if I connect 3.3V and GND from Xenon directly to the above motor it works fine. Once again I am sorry for not putting in more details.
One thing with that motor is that it is only rated for 3.0 to 6.0V so your 9V supply may not be the safest to use.
How are you powering the Xenon?
What gateway are you using for your Xenon? (they normally don't run without one)
You didn't address this point
Is you Xenon breathing cyan?
I think your code isn't really running.
To test that theory alter your code like this and see whether the D7 LED comes on or not.
Can you post a photo of your setup?
What happens when you connect AIN1 to GND and AIN2 to 3v3? (disconnect D2/D3 when trying)
How are you now powering the motor (since 9V is no option)?
BTW, you don’t need to permanently set the pin states in loop() this should do
const int pinFWD = D2;
const int pinBACK = D3;
const int pinSLP = D7;
void setup() {
Particle.function("drive", setDrive);
pinMode(FWD , OUTPUT);
pinMode(BACK, OUTPUT);
pinMode(SLP , OUTPUT); // SLP/ (active LOW)
}
int setDrive(String arg) {
int dir = 0;
digitalWrite(SLP , LOW); // disengage driver
digitalWrite(FWD , LOW);
digitalWrite(BACK, LOW);
if (arg.toUpperCase() == "FORWARD") {
dir = +1;
digitalWrite(FWD, HIGH); // prepare for forward drive
}
else if (arg.toUpperCase() == "BACK") {
dir = -1;
digitalWrite(BACK, HIGH); // prepare for reverse drive
}
else
return 0; // no valid direction, motor stopped
digitalWrite(SLP, HIGH); // wake the driver and apply preselected direction
return dir;
}
I took the liberty to move the SLP/ pin to D7 to have a visual feedback whether the driver is supposed to be active or not and add a function you could call remotely to select forward/backward drive.
Even after connecting AIN1 to GND and AIN2 to 3v3, the motor did not start. After your suggestion, I moved the power source for the motor driver from 9V to 4 1.5 V AAA batteries. I moved the SLP to D7 and I can see it turn ON after I flash the code to Xenon.
I am attaching pictures for your review. Thanks again for all your help.
I just finished soldering. I checked the voltages and I got AIN1 - GND (3.3V) , SLP - GND (3.3V), AIN2 - GND ( 0V) , VM - GND (6.3 V). My motor is still not running.
Sorry to say, but these solder joints don’t really look right.
You also soldered the board upside down. While this wouldn’t matter too much for testing it will give you headache when you want to run the motor for some longer time as the actual driver chip will probably overheat as it can’t dissipate enough heat that way.
Have you got anybody who can help you with unsolering these pins and resolder them the correct way and in a fashion that will give you reliable contacts.
You should read and watch that Guide to Excellent Soldering featured in the linked Adafruit page I referred you to above.
This is how your soldered board should look like
A nice solid coat - no blobs - of solder connecting both the pin and the soldering pad (all around).