Shop OBEX P1 Docs P2 Docs Learn Events
DHB-10 Motor Controller Propeller C Code hangs if DHB-10 is off or disconnected — Parallax Forums

DHB-10 Motor Controller Propeller C Code hangs if DHB-10 is off or disconnected

Why does this code stop printing the screen after 3 loops if the DHB-10 isn't connected?

Shouldn't the main loop keep working even if the cog is stalled on sending the command to the DHB-10?
#include "simpletools.h"
#include "fdserial.h"
#include "arlodrive.h"

fdserial *term;

void monitorMotorController(void *par);

static int monitorMotorControllerStack[256];

char dhb10_reply[DHB10_LEN];

int main() {

    simpleterm_close(); // Close simplex serial terminal
    term = fdserial_open(31, 30, 0, 115200); // Open global Full Duplex serial connection to USB Serial interface.

    cogstart(&monitorMotorController, NULL, monitorMotorControllerStack, sizeof monitorMotorControllerStack);

    int count = 0;

    while (1) {
        dprint(term, "i\t%d\n", count);
        count++;
        pause(200);
    }

}

void monitorMotorController(void *par) {

    dhb10_com("GOSPD 0 0\r");

}
Sign In or Register to comment.