Can't compile - 'class MeEncoderNew' has no member named 'GetCurrentSpeed'


#1

Hello!

I have an Adruino Uno and Me Encoder Motor Driver.

Here is my code:

#include “MeOrion.h”
#include <Wire.h>
#include <SoftwareSerial.h>

float SpeedRevMin = 0;
float ValueADC = 0;

MeEncoderNew motor1(0x09, SLOT1);

void setup()
{
motor1.begin();
motor1.runSpeed(100);

Serial.begin(250000);
}

void loop()
{
SpeedRevMin = motor1.GetCurrentSpeed();

ValueADC = 0.0264 * (analogRead(0) - 512);

Serial.print(SpeedRevMin);
Serial.print(" ");
Serial.print(ValueADC);
Serial.println();
}

When I’m trying to compile it - I see the next error:

Arduino: 1.8.1 (Windows 10), Плата:“Arduino/Genuino Uno”

C:\Users\Daemon\Documents\Arduino\PrimoVictoria\PrimoVictoria.ino: In function ‘void loop()’:

PrimoVictoria:20: error: ‘class MeEncoderNew’ has no member named ‘GetCurrentSpeed’

SpeedRevMin = motor1.GetCurrentSpeed();

                    ^

exit status 1
’class MeEncoderNew’ has no member named ‘GetCurrentSpeed’

Can you, please, help me?


#2

The member name is getCurrentSpeed. C/C++ are case-sensitive. :slight_smile:

Generally speaking, the coding convention for members is to start with a lowercase character on the first word and uppercase the first character on all subsequent words in the member name.

Hope this helps. :smiley:


#3

Thank you! It worls :slight_smile:
But I’ve wrote as in documentation here http://learn.makeblock.com/api-documentation-of-me-encoder-motor/

float currentSpeed = motor1.GetCurrentSpeed();

#4

@tec_support, seems to be a typo on the Learn site (see above).


#5

Thanks for your feedback! We’ll revise this typo asap!


#6