How do the move() and moveTo() methods for controlling Me Encoder Motor Shield work?


#1

Hey.
I have makeblock Orion and Me Encoder Motor.
I downloaded the Arduino IDE (I used versions 1.6.9 and 1.8.8 - latest) in it I chose the Arduino UNO / Genuino device, and the corresponding COM port.


http://learn.makeblock.com/api-documentation-of-me-encoder-motor/

2 motors are connected to Me Encoder motor and Me Encoder Motor itself is connected to makeblock Orion to red port # 1. And all this is fixed on a platform with wheels.

With the Arduino code, I’m trying to control the motors.

  1. API Documentation of Me Encoder Motor is not written correctly. There all methods are written with a capital letter, but actually in Makeblock library method names begin with a small letter, if you write them as it is written in the documentation, there will be a compilation error.
  2. I don’t understand what move (), moveTo () methods do. Please explain what they are doing.
    And what is the difference between relative and absolute angles?
    I tried using this code:

///

#include <MeOrion.h>
#include <SoftwareSerial.h>
#include <Wire.h>
MeEncoderMotor motor1(0x09, SLOT1);
MeEncoderMotor motor2(0x09, SLOT2);
void setup()
{
  motor1.begin();
  motor2.begin();
  Serial.begin(9600);
}
void loop()
{
  motor1.move(360, 100);
  motor2.move(360, 100);
  delay(10000);
}

And the wheels turned half a turn, so each wheel turned 180 degrees around its axis.
Then I use this code:

#include <MeOrion.h>
#include <SoftwareSerial.h>
#include <Wire.h>
MeEncoderMotor motor1(0x09, SLOT1);
MeEncoderMotor motor2(0x09, SLOT2);
void setup()
{
  motor1.begin();
  motor2.begin();
  Serial.begin(9600);
}
void loop()
{
  motor1.move(360*4, 100);
  motor2.move(360*4, 100);
  delay(10000);
}

And each wheel turned 2 full turns, i.e. 720 degrees.
Then I used this code:

#include <MeOrion.h>
#include <SoftwareSerial.h>
#include <Wire.h>
MeEncoderMotor motor1(0x09, SLOT1);
MeEncoderMotor motor2(0x09, SLOT2);
void setup()
{
  motor1.begin();
  motor2.begin();
  Serial.begin(9600);
}
void loop()
{
  motor1.move(360*10, 100);
  motor2.move(360*10, 100);
  delay(10000);
}

And the wheels were spinning nonstop.

How does an argument with degrees in move() and moveTo () metadata work at all? What do these degrees do?


#2

Please check the email from stephanie.wu@makeblock.com


#3

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.