Giter VIP home page Giter VIP logo

cmdarduino's People

Contributors

fakufaku avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cmdarduino's Issues

Sending inadvertent '\r\n' (Carriage Return & Line Feed) breaks CmdArduino.

Hello,

I was very happy to find a simple serial command line interface for my Arduino sketches. Thank you for writing this!

Initially I was unable to get "cmd_line_ex1_hello.pde" working until I figured out that I was terminating the command strings sent through the terminal program with \r\n instead of just \r.

I don't recall seeing any notes about using only \r for string terminations in the comments, and I didn't realize that \r\n was corrupting the input buffer for every command sent after the first command sent. I found the problem while reviewing the "switch (c)" code of Cmd.cpp and verifying that your screen capture example showing the use of "Carriage return" terminations as see on flicker at:

https://www.flickr.com/photos/22874071@N05/10473274214/in/photostream/

To prevent an accidental \r\n from breaking the input routine, I added a filter to remove all incoming \n characters. I don't know how often \n might be a valid input character that is being incorrectly filtered out, but the likelihood of \r\n being sent accidentally as I move between different terminal programs highly likely. Someone needing the \n character could just comment out the filtering case.

I implemented the \n filter by making a copy of the case '\b' functionality for '\n' instead of '\b', and not echoing the \n character back to the terminal. Below is the full modified switch statement with the additional case statement added.

I am not familiar with pulling/pushing code changes through GitHub directly, so I opened this as an issue instead.

Regards,

Darrell


switch (c)
{
case '\r':
    // terminate the msg and reset the msg ptr. then send
    // it to the handler for processing.
    *msg_ptr = '\0';
    Serial.print("\r\n");
    cmd_parse((char *)msg);
    msg_ptr = msg;
    break;

case '\b':
    // backspace 
    Serial.print(c);
    if (msg_ptr > msg)
    {
        msg_ptr--;
    }
    break;

case '\n':    // This case added by d. on 6/5/2015. 
    // remove linefeeds so receiving \r\n won't corrupt buffer for next command 
    // Serial.print(c);     // Do not echo \n back to terminal 
    if (msg_ptr > msg)
    {
        msg_ptr--;
    }
    break;

default:
    // normal character entered. add it to the buffer
    Serial.print(c);
    *msg_ptr++ = c;
    break;
}

A simple implementation allowing any input

Hi guys,

I was wondering if either fakufaku/CmdArduino or joshmarinacci/CmdArduino allow for an implementation that accepts any command I send my Arduino Yun?

I am sending commands over the Yun bridge and I would like for my Python script to be able to send anything and have the Arduino follow it.

To be honest with you, if there was some way I could convert a command received via port->readString() and run it, that's all I need. Thank you!

Adding Description and Function Dumper

I've added a couple of additions to the library

One adds a "Description" to the command add and structure which allows you to add a description of the command.

The other one is a table dump which is useful for just dumping out what commands are available.

If anyone is interested, i'll do a PR

This does not work

Serial Monitor just repeats what I type...

Even python and javascript coders be busting out working codez.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.