Hi,
I enclosed a part of a code that run two 5V DC Fans based on temperature reading.
It works fine but I noticed that while the fans are not working (when if (temperature<86)), the fans are getting extremely warm. It does not happen while they are working (if (temperature>86)). The Qwiic Motor Driver is getting power via VIN connectors.
Any ideas why? Do I miss something in the code?
The configuration is:
RedBoard Qwiic
Digital Temperature Sensor - TMP102 (Qwiic)
Qwiic Motor Driver
Code:
...
include <SCMD.h>
#include <SCMD_config.h>
...
//Motor driver
SCMD myMotorDriver;
#define LEFT_MOTOR 0
#define RIGHT_MOTOR 1
...
void setup()
{
myMotorDriver.settings.commInterface = I2C_MODE;
myMotorDriver.settings.I2CAddress = 0x5D;
//*****initialize the driver get wait for idle*****//
while ( myMotorDriver.begin() != 0xA9 ) //Wait until a valid ID word is returned
{
Serial.println( "ID mismatch, trying again" );
}
Serial.println( "ID matches 0xA9" );
// Check to make sure the driver is done looking for peripherals before beginning
Serial.print("Waiting for enumeration...");
while ( myMotorDriver.ready() == false );
Serial.println("Done.");
Serial.println();
while ( myMotorDriver.busy() );
myMotorDriver.enable();
}
...
void loop()
{
//Motors activation
if (temperature>86) {
myMotorDriver.setDrive( LEFT_MOTOR, 0, 255);
myMotorDriver.setDrive( RIGHT_MOTOR, 0, 255);
}
if (temperature<86) {
myMotorDriver.setDrive( LEFT_MOTOR, 0, 0);
myMotorDriver.setDrive( RIGHT_MOTOR, 0, 0);
}