Propeller Activity Board HELP

Hi everyone, i'm new to the forum and also new to this programming activity board. I just recently got me an activity board and two hb-25 motor controller. I'm having trouble on how to get the motor to work on this board. This is the code that parallax provided as an example but i have no clue on it. Can someone please help me with it so i can understand. For the setup i have a motor connected to the hb 25 motorl terminal and a 6v battery connected to the battery terminal of the hb 25 motor control. Then i connect the hb 25 using a servo cable to the activity board to pin 15. Please let me know if i have the connect right .Thank you and this is the example code:

Two DC Motors 60 Percent.c

Version 0.94 for use with SimpleIDE 9.40 and its Simple Libraries

Drive a pair of DC motors at 6/10 of full speed.

#include "simpletools.h"

int main()
// Keep pins low if unused.
set_outputs(5, 2, 0b0000);
set_directions(5, 2, 0b1111);

// Start PWM process. Period 1 ms, Freq 1 kHz
// Turn motors counterclockwise for 3 s.
pwm_set(3, 0, 600);
pwm_set(4, 1, 600);

// Stop for 1 second.
pwm_set(3, 0, 0);
pwm_set(4, 1, 0);

// Turn motors counterclockwise for 3 s.
pwm_set(2, 0, 600);
pwm_set(5, 1, 600);

// Stop again
pwm_set(2, 0, 0);
pwm_set(5, 1, 0);
// End the PWM process


  • 5 Comments sorted by Votes Date Added
  • edited December 2013 Posts: 0Vote Up0Vote Down
    The HB-25 is controlled like a CR servo. The code you posted looks like it for a motor controlled by a conventional H-bridge.

    You could use normal ActivityBot code to drive the HB-25 since the ActivityBot uses CR servos to get around.

    I haven't used C on the Propeller much but I could find what "set_outputs" does by looking at this page.

    I don't think you'll need to use these same function to use the HB-25. You'll want to use the functions normally used to control servos.
  • edited December 2013 Posts: 0Vote Up0Vote Down
    I also don't use C for anything but edification. There is a standard in your SimpleIDE examples folder, "Standard Servo Position.side." You just need to set the pin to 15 rather than 16. I haven't tried this but if you adjust the pause to 5ms? I think you can drive your connected HB25's with one pin.
  • edited December 2013 Posts: 2Vote Up0Vote Down
    Thanks for the advice. I try to use the normal activity coding for servo and switch it to pin 15 but still didn't work. i use the example code:
    Standard Servo Position.c Moves servo to 0, 90 and 180 degrees. Holds each position for 2 s. Connect servo to P16 port on Propeller Activity Board.*/
    #include "simpletools.h" // Include simpletools header
    #include "servo.h" // Include servo header
    int main() // main function
    servo_angle(15, 0); // P15 servo to 0 degrees
    pause(3000); // ...for 3 seconds
    servo_angle(15, 900); // P15 servo to 90 degrees
    pause(3000); // ...for 3 seconds
    servo_angle(15, 1800); // P15 servo to 180 degrees
    pause(3000); // ...for 3 seconds
    servo_stop(); // Stop servo process
  • edited December 2013 Posts: 0Vote Up0Vote Down
    huutinhsau wrote: »
    . . .but still didn't work. i use the example code: . . .

    When you say it didn't work, what does that mean? Did the motor move at all?

    What kind of motor (how much current can it draw) are you using and what sort of 6V battery (how much current can is provide)?

    You've probably noticed the forum software destroys the indentation in code. Here's a link to a tutorial on posting code to the forum.

Sign In or Register to comment.