0
/*
  #include <SmartInventor.h>

*/

void setup() {
  SmartInventor.DCMotor();




}
void loop() {
  // M1, M2, M3
  // CW, CCW, STOP
  // 0-100
  // 0-360

  SmartInventor.DCMotor(M1, CW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M1, STOP, 0, 0°);
  delay(5000);

  SmartInventor.DCMotor(M1, CCW, 10, 45°);  //Music starts  //0:00:06
  delay(2000);

  SmartInventor.DCMotor(M1, CCW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M1, STOP, 0, 0°);
  delay(11000);

  SmartInventor.DCMotor(M1, CW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M1, STOP, 0, 0°); //Music stops   //0:00:32
  delay(10000);

  SmartInventor.DCMotor(M1, CW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M1, STOP, 0, 0°);
  delay(5000);

  SmartInventor.DCMotor(M1, CCW, 10, 45°);
  delay(1000);

  SmartInventor.DCMotor(M1, CW, 10, 45°); //Music starts back up    //0:00:44
  delay(2000);

  SmartInventor.DCMotor(M1, STOP, 0, 0°);
  delay(18000);

  SmartInventor.DCMotor(M1, CCW, 10, 90°);
  delay(3000);

  SmartInventor.DCMOtor(M1, CW, 10, 45°);
  delay(2000);

  SmartINventor.DCMotor(M1, STOP, 10, 0°);
  delay(8000);

  SmartInventor.DCMOtor(M1, CW, 10, 45°); //Music stops   //0:01:15
  delay(2000);

  SmartInventor.DCMotor(M1, STOP, 0, 0°);
  delay(5000);

  SmartINventor.DCMotor(M1, CCW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M1, CCW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M1, STOP, 0, 0°);
  delay(3000);

  SmartInventor.DCMotor(M1, CW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M1, CCW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M1, STOP, 0, 0°); //Music starts up agian   //0:01:31
  delay(11000);

  SmartInventor.DCMotor(M1, CW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M1, CW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M1, STOP, 0, 0°); //Music stops     //0:02:03
  delay(23000);

  SmartInventor.DCMotor(M1, CCW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M1, STOP, 0, 0°); //Music starts up agian   //0:02:14
  delay(12000);

  SmartInventor.DCMotor(M1, CCW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M1, STOP, 0, 0°);
  delay(6000);

  SmartInventor.DCMotor(M1, CW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M1, STOP, 0, 0°);
  delay(6000);

  SmartInventor.DCMotor(M1, CCW, 10, 45°); //Music Ends    //0:02:40
  delay(2000);

  SmartInventor.DCMotor(M1, CW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M1, STOP, 0, 0°);
  delay(3000);

  SmartInventor.DCMotor(M2, CW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, CW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, STOP, 0, 0°);
  delay(5000);

  SmartInventor.DCMotor(M2, CCW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, STOP, 0, 0°);
  delay(2000);

  SmartInventer.DCMotor(M2, CCW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, STOP, 0, 0°);
  delay(2000);

  SmartInventor.DCMotor(M2, CW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, STOP, 0, 0°);
  delay(2000);

  SmartInventor.DCMotor(M2, CW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, CCW, 10, 45°);
  delay(2000)

  SmartInventor.DCMotor(M2, STOP, 0, 0°);
  delay(2000);

  SmartInventer.DCMotor(M2, CCW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, STOP, 0, 0°);
  delay(2000);

  SmartInventor.DCMotor(M2, CW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, STOP, 0, 0°);
  delay(2000);

  SmartInventor.DCMotor(M2, CW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, CCW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, STOP, 0, 0°);
  delay(13000);

  SmartInventor.DCMotor(M2, CCW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, STOP, 0, 0°);
  delay(2000);

  SmartInventer.DCMotor(M2, CW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, STOP, 0, 0°);
  delay(2000);

  SmartInventor.DCMotor(M2, CW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, STOP, 0, 0°);
  delay(2000);

  SmartInventor.DCMotor(M2, CCW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, CCW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, STOP, 0, 0°);
  delay(2000);

  SmartInventer.DCMotor(M2, CW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, STOP, 0, 0°);
  delay(2000);

  SmartInventor.DCMotor(M2, CW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, STOP, 0, 0°);
  delay(2000);

  SmartInventor.DCMotor(M2, CCW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, CCW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, STOP, 0, 0°);
  delay(13000);

  SmartInventor.DCMotor(M2, CW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, CW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, CCW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, STOP, 0, 0°);
  delay(2000);

  SmartInventer.DCMotor(M2, CCW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, STOP, 0, 0°);
  delay(2000);

  SmartInventor.DCMotor(M2, CW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, STOP, 0, 0°);
  delay(2000);

  SmartInventor.DCMotor(M2, CW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, CCW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, STOP, 0, 0°);
  delay(2000);

  SmartInventer.DCMotor(M2, CCW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, STOP, 0, 0°);
  delay(2000);

  SmartInventor.DCMotor(M2, CW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, STOP, 0, 0°);
  delay(2000);

  SmartInventor.DCMotor(M2, STOP, 0, 0°);
  delay(2000);

  SmartInventer.DCMotor(M2, CCW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, STOP, 0, 0°);
  delay(13000);

  SmartInventor.DCMotor(M2, CCW, 10, 45°);
  delay(2000)

  SmartInventor.DCMotor(M2, STOP, 0, 0°);
  delay(2000);

  SmartInventer.DCMotor(M2, CCW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, STOP, 0, 0°);
  delay(2000);

  SmartInventor.DCMotor(M2, CW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, STOP, 0, 0°);
  delay(2000);

  SmartInventor.DCMotor(M2, CW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, CCW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, STOP, 0, 0°);
  delay(2000);

  SmartInventer.DCMotor(M2, CCW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, STOP, 0, 0°);
  delay(2000);

  SmartInventor.DCMotor(M2, CW, 10, 45°);
  delay(2000);

  SmartInventor.DCMotor(M2, STOP, 0, 0°);
  delay(7000);

  SmartInventor.DCMotor(M3, STOP, 0, 0°);
  delay(7000);

  SmartInventor.DCMotor(M3, CW, 20, 360°);
  delay(26000);

  SmartInventor.DCMotor(M3, STOP, 0, 0°);
  delay(12000);

  SmartInventor.DCMotor(M3, CW, 20, 360°);
  delay(31000);

  SmartInventor.DCMotor(M3, STOP, 0, 0°);
  delay(12000);

  SmartInventor.DCMotor(M3, CW, 20, 360°);
  delay(31000);

  SmartInventor.DCMotor(M3, STOP, 0, 0°);
  delay(12000);

  SmartInventor.DCMotor(M3, CW, 20, 360°);
  delay(26000);

  SmartInventor.DCMotor(M2, STOP, 0, 0°);
  delay(5000);

  < SmartInventor.h / >

}
| improve this question | | | | |
  • What's with all the ° symbols in your code? – Majenko Mar 19 at 20:24
  • 1. When you get compiler errors, it is mandatory to also include the complete error message, as you get it from the compiler, into your question. We need it to help you better. 2. What is doing thing statement < SmartInventor.h / > at the end of the program? That looks somewhat like a XML/HTML tag – chrisl Mar 19 at 20:25
  • ° is degrees, is that the problem , also I used that because I want the motors to spin clockwise counterclockwise only 45 or 90 or 360 degrees, can u help me fix it if I did it wrong – Tommy Mar 19 at 20:57
  • Yes, that is also wrong. Delete all ° characters from the code – chrisl Mar 19 at 20:59
  • than how do I make it not do a full spin and only make it a 45 or 90 degree spin – Tommy Mar 19 at 21:32
1

You code shows multiple errors:

  1. At the start you are commenting the SmartInventor library out. You need this library. You should delete the comment markers /* and */ around the #include statement.

  2. At the end of the code you have < SmartInventor.h / >. You should delete this line. It is simply wrong, not even C/C++ syntax.

  3. You seem to misunderstand, what SmartInventor.DCMotor() is and does. First this is a DC motor. That means, that you don't have control over the angle of the motor. You can give it a direction and a speed. Nothing more. And with a standard DC motor (without gears) you cannot even hope for getting specific angles from it, not even through sophisticated controls. The motor is simply not made for such tasks.

    When you look into SmartInventor.h, you can see the declaration of that function:

    void SmartInventorClass::DCMotor(char SelectMotor, char direction, char speed)
    

    You have too many parameters there. You can give this function 2 or 3 parameters (the 2 parameter prototype is not shown here, you can see it in the header file). Use the function as described.

  4. Connected to the previous problem: You tried to use the ° degree character in your code. You cannot do that. It is not a valid character in the C/C++ syntax. In general all the numbers in a program don't have a unit attached to them. You don't write delay(1000ms) to delay 1s, you write delay(1000). It is up to the function, to interpret this number, as it likes to. You only know from the documentation of that function (or from it's implementation in code), that the parameters means time in milliseconds. For the microcontroller the unit millisecond does not have a meaning. The same goes with degree. When controlling a servo, which you can give the desired angle, you write servo.write(90) for setting it to 90°. No degree sign there.

| improve this answer | | | | |
  • So I use delay(1000) for mine? and what do you mean by too much parameters? – Tommy Mar 19 at 23:21
  • You are using DCMotor(M1, STOP, 0, 0°). That are 4 parameters for the function. But the function has only 2 or 3 parameters. You cannot provide more parameters. – chrisl Mar 19 at 23:26
  • The delay() function was used correctly by you. I just used this function to explain, that the microcontroller does not know about units. – chrisl Mar 19 at 23:26
  • Ok I just deleted ° and i did everything u told me to do but now it says no matching function call to 'SmartInentor::DCMotor()' – Tommy Mar 19 at 23:49
  • 1
    The full error message. The compiler gives you a rather extensive explanation, what is wrong where. You didn't include the full error message the first time, so please at least do it now. I don't like to guess, what exactly the error is. – chrisl Mar 20 at 0:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.