Shop OBEX P1 Docs P2 Docs Learn Events
Sketch problem with BOE and Arduino Shield Bot — Parallax Forums

Sketch problem with BOE and Arduino Shield Bot

druid001druid001 Posts: 2
edited 2014-05-20 16:09 in Learn with BlocklyProp
Just started the BOE Arduino robot project. I'm still in the first chapter "Your Shield Bot's Brain" learning the programming. I'm at the sketch in Chap 3 called TestServoSpeed. When I run the sketch everything happens except...the wheel doesn't turn!. I'm posting my sketch:

#include <Servo.h>


Servo servoLeft;
Servo servoRight;


void setup()
{
tone(4, 3000, 1000);
delay(1000);


Serial.begin(9600);
servoLeft.attach(13);
}


void loop()
{
for(int pulseWidth=1375; pulseWidth<=1625; pulseWidth+=25)
{
Serial.print("pulseWidth= ");
Serial.println(pulseWidth);
Serial.println("Press a key and click");
Serial.println("Send to start servo...");

while(Serial.available() == 0);
Serial.read();

Serial.println("Running...");
servoLeft.writeMicroseconds(pulseWidth);
delay(6000);
servoLeft.writeMicroseconds(1500);
}
}

I even copy\pasted the one in the tutorial with the same outcome. Can anyone see what is wrong with the sketch? Unfortunately there doesn't seem to be a direct way to ask about this, so I've come to the forums. Thanks.

Comments

  • druid001druid001 Posts: 2
    edited 2014-05-19 17:56
    I'm such a NOOB! After so much time re-doing the sketch turns out I didn't turn on the servo Power switch on the BOE! So embarrassed. Thanks anyway!
  • Duane DegnDuane Degn Posts: 10,588
    edited 2014-05-19 20:34
    druid001 wrote: »
    I'm such a NOOB! After so much time re-doing the sketch turns out I didn't turn on the servo Power switch on the BOE! So embarrassed. Thanks anyway!

    Thanks for letting us know. We've all done something like this. I'm glad you let us know you figured out the problem even if it was something simple.

    While this might not be the best place to get help with Arduino code, you are very welcome to ask your Arduino coding questions here. Several of us use the Arduino and may be able to help with your questions.

    Next time you post code, it will help us read it if you use code tags.

    [noparse]
      // Your code here.
        // Indented code.
    
    [/noparse]

    The above will show up as:
      // Your code here.
        // Indented code.
    

    Without code tags the forum software removes indentations which destroys the formatting of the code.

    BTW, Welcome to the forum.
  • Steph LindsaySteph Lindsay Posts: 767
    edited 2014-05-20 16:09
    +1 what Duane said! Please don't hesitate to ask questions and report found solutions. No matter how "noob" they seem, they will help someone else!
Sign In or Register to comment.