You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • @Robin, @Skog is trying to do this: http://www.espruino.com/Interfacing#wind­ows

    @Skog what you're doing looks good to me, however the command:

    C:\>echo LED2.set() > \\:\COM4
    

    Isn't going to receive anything from the board - the > is telling windows you're just writing to COM4 and not reading from it.

    As @allObjects says, in Linux/Mac you generally have another process running that's piping from the COM port in the background, but I'm not sure how that works in Windows.

    Ok, I just googled it. Not tried it but there's a bunch of stuff out there as this is something people often do with Arduino by the look of it:

    https://stackoverflow.com/questions/1948­9733/batch-file-receive-data-from-the-se­rial-port-and-write-it-into-txt-file

    So:

    mode COM4 BAUD=9600 PARITY=n DATA=8
    echo yourCommand() >COM4
    COPY COM4 data.txt
    

    Will pipe the data to a file until the Pico sends a Ctrl-Z character ("\x1A")

    Or I believe:

    mode COM4 BAUD=9600 PARITY=n DATA=8
    echo yourCommand() >COM4
    set /p line=<COM4
    

    May work for a single line. However you may end up just getting the end of the line that is the command, as Espruino will echo back the command that is sent to it unless echo(0) has been called or there's a special char at the beginning of the line. Check out the NOTE: right at the top of http://www.espruino.com/Interfacing

    Also it's worth checking your MODE command as it looks like you're trying to set the baud rate to 96, not 9600. Over USB it may not matter, but 96 is super slow (10 chars per second :) and may not even be supported on some PCs/adaptors.

    To be honest past a certain point you may find it's easier/more reliable to use a Python script to get your data and to then call that from the command prompt: http://www.espruino.com/Interfacing#pyth­on-multiplatform-

About

Avatar for Gordon @Gordon started