You are reading a single comment by @user49360 and its replies. Click here to read the full conversation.
  • Hello,

    I'm working on a project involving driving stepper motors via RS485.
    I've found a nice converter board:

    http://arduino-info.wikispaces.com/SoftwareSerialRS485Example

    I converted this example to JavaScript and I got it working.

    digitalWrite(B8, 0);
    Serial1.setup(9600, {tx:B6,rx:B7,bytesize:8,parity:'none',stopbits:1});
    Serial1.on('data', function (data) { print("<Serial1> "+data); });
    
    digitalWrite(B8, 1); digitalWrite(LED2, 1);
    setTimeout(function() {Serial1.print("@01STOP\r");}, 5);
    setTimeout(function() {digitalWrite(B8, 0);}, 15);
    
    

    The only problem is that the stepper motors have encoders, which will reply (very fast) when I send a serial command. This means I have to make my driver enable output LOW as fast as possible after sending my command.

    Timeouts may work, but the timings vary, as different commands require more or less time to print.
    Does anyone have any idea how to make sure the driver enable pin goes to LOW as soon as the Espruino is done sending?

    Sorry if my English is not that good, but I hope you guys can understand my question :)

    Thanks in advance,

    Eric

About

Avatar for user49360 @user49360 started