void setup() {
Serial.begin(115200);
}
void loop() {
// put your main code here, to run repeatedly:
static unsigned long lastMilli = 0;
static bool cwDirection = true; // assume initial direction(positive pwm) is clockwise
static int pwm = 1;
if(millis()-lastMilli > 50){ // every 50 millisecond
if (cwDirection && pwm++ > 100 ) {
cwDirection = false;
} else if (!cwDirection && pwm-- < -100) {
cwDirection = true;
}
motorA.motorGo(pwm);
lastMilli = millis();
Serial.println(motorA.getPWM()); // we can just print pwm but just showing that member function getPWM() works.
}
}
the error:
C:\Users\TomDa\AppData\Local\Temp.arduinoIDE-unsaved2023717-10736-16fr1up.j7yzh\exampleMX1508\exampleMX1508.ino:9:44: error: invalid conversion from 'int' to 'NumOfPwmPins' [-fpermissive]
MX1508 motorA(PINA,PINB, FAST_DECAY, NUMPWM);
^
In file included from C:\Users\TomDa\AppData\Local\Temp.arduinoIDE-unsaved2023717-10736-16fr1up.j7yzh\exampleMX1508\exampleMX1508.ino:2:0:
c:\Users\TomDa\OneDrive\Documenten\Arduino\libraries\MX1508/MX1508.h:21:5: error: initializing argument 4 of 'MX1508::MX1508(uint8_t, uint8_t, DecayMode, NumOfPwmPins)' [-fpermissive]
MX1508(uint8_t pinIN1, uint8_t pinIN2, DecayMode decayMode, NumOfPwmPins numPWM);
^
Multiple libraries were found for "MX1508.h"
Used: C:\Users\TomDa\OneDrive\Documenten\Arduino\libraries\MX1508
Not used: C:\Users\TomDa\OneDrive\Documenten\Arduino\libraries\MX1508Stop
exit status 1
Compilation error: invalid conversion from 'int' to 'NumOfPwmPins' [-fpermissive]
HW-Tiny88 MX1508 code won't upload. the Code:
include
define PINA 9
define PINB 10
define NUMPWM 2
MX1508 motorA(PINA,PINB, FAST_DECAY, NUMPWM);
void setup() { Serial.begin(115200); } void loop() { // put your main code here, to run repeatedly: static unsigned long lastMilli = 0; static bool cwDirection = true; // assume initial direction(positive pwm) is clockwise static int pwm = 1;
if(millis()-lastMilli > 50){ // every 50 millisecond if (cwDirection && pwm++ > 100 ) {
cwDirection = false; } else if (!cwDirection && pwm-- < -100) { cwDirection = true; } motorA.motorGo(pwm); lastMilli = millis(); Serial.println(motorA.getPWM()); // we can just print pwm but just showing that member function getPWM() works. }
}
the error: C:\Users\TomDa\AppData\Local\Temp.arduinoIDE-unsaved2023717-10736-16fr1up.j7yzh\exampleMX1508\exampleMX1508.ino:9:44: error: invalid conversion from 'int' to 'NumOfPwmPins' [-fpermissive] MX1508 motorA(PINA,PINB, FAST_DECAY, NUMPWM); ^ In file included from C:\Users\TomDa\AppData\Local\Temp.arduinoIDE-unsaved2023717-10736-16fr1up.j7yzh\exampleMX1508\exampleMX1508.ino:2:0: c:\Users\TomDa\OneDrive\Documenten\Arduino\libraries\MX1508/MX1508.h:21:5: error: initializing argument 4 of 'MX1508::MX1508(uint8_t, uint8_t, DecayMode, NumOfPwmPins)' [-fpermissive] MX1508(uint8_t pinIN1, uint8_t pinIN2, DecayMode decayMode, NumOfPwmPins numPWM); ^ Multiple libraries were found for "MX1508.h" Used: C:\Users\TomDa\OneDrive\Documenten\Arduino\libraries\MX1508 Not used: C:\Users\TomDa\OneDrive\Documenten\Arduino\libraries\MX1508Stop exit status 1
Compilation error: invalid conversion from 'int' to 'NumOfPwmPins' [-fpermissive]