fakufaku / cmdarduino Goto Github PK
View Code? Open in Web Editor NEWSimple serial command line prompt for Arduino. Developed by Akiba from @freaklabs
Home Page: http://freaklabs.org/index.php/Tutorials/Software/Tutorial-Using-CmdArduino.html
Simple serial command line prompt for Arduino. Developed by Akiba from @freaklabs
Home Page: http://freaklabs.org/index.php/Tutorials/Software/Tutorial-Using-CmdArduino.html
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;
}
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!
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
Serial Monitor just repeats what I type...
Even python and javascript coders be busting out working codez.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.