Pages: [1]   Go Down
Author Topic: I create an int called "speed" and it turns orange like a command  (Read 250 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I create an integer called "speed" and it turns orange like a command.  I have looked all over, but cannot find such a command.

Code:
void MoveWheels(WheelDirection (dir), int speed) {

    if (MotorOff) return;

    if (speed > 255) speed = 255;

    else if (speed < 0) speed = 0;

    if (dir == DIR_STOP) {

        digitalWrite(ahi, HIGH);      //set ahi and bhi osmc
        digitalWrite(bhi, HIGH);
        digitalWrite(dis, LOW);
        digitalWrite(ali, LOW);
        digitalWrite(bli, LOW);

    } else if (dir == DIR_FORWARD) {

        digitalWrite(ahi, HIGH);      //set ahi and bhi osmc
        digitalWrite(bhi, HIGH);
        digitalWrite(dis, LOW);
        digitalWrite(ali, LOW);
        analogWrite(bli, speed);
Logged

California
Offline Offline
Faraday Member
**
Karma: 82
Posts: 3123
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It's probably defined in a keywords.txt for one of your libraries.
Logged

UK
Offline Offline
Faraday Member
**
Karma: 92
Posts: 3969
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It's in the Stepper library:

Code:
$ grep -r speed * | grep keywords.txt
libraries/Stepper/keywords.txt:speed KEYWORD2

Yet one more failing of the IDE - it should only take note of keywords for libraries you actually have included.
Logged

Why not visit my eBay shop? http://stores.ebay.co.uk/Majenko-Technologies
Replacement for the Arduino IDE: UECIDE - Proper serial terminal, graphing facilities, plugins, overhauled internals.
Java isn't bad in itself, but it has enabled morons to write programs.

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 548
Posts: 46029
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Yet one more failing of the IDE - it should only take note of keywords for libraries you actually have included.
I think that it is more a failing of the Stepper library author. Keywords are supposed to be just that. Key words that mean something to the class, like method names. The words direction and speed are not methods of the Stepper library, while setSpeed and step are. It is reasonable that setSpeed and step are in the keywords file. It is not reasonable that speed and direction are.

The whole color-coding stuff is silly, though. The word step should only be colored if it is a method(). It is not rocket science to recognize .step( and ->step( as distinct from // We need to step until...
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ah, got it.  It worked so i left it alone.  I don't mind these little anomalies when we have a help resource so smart, so fast and so free.

thanks a lot!!

glenn
Logged

Pages: [1]   Go Up
Jump to: