Arduino-SerialCommand | Arduino library to tokenize and parse commands
kandi X-RAY | Arduino-SerialCommand Summary
kandi X-RAY | Arduino-SerialCommand Summary
The original version of this library was written by [Steven Cogswell] (published May 23, 2011 in his blog post ["A Minimal Arduino Library for Processing Serial Commands"] This is a heavily modified version with smaller footprint and a cleaned up code by Stefan Rado.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Arduino-SerialCommand
Arduino-SerialCommand Key Features
Arduino-SerialCommand Examples and Code Snippets
Community Discussions
Trending Discussions on Arduino-SerialCommand
QUESTION
so following problem: I am currently writing a small program for my NUCLEO F207ZG which provides an interface for other services over the serial port. The goal of my program is to expose data with commands like ?variable
and set values with !variable
(eg. ?threshold
returns 1400 and !threshold 1234
sets threshold to 1234). Additonally the variables in my program are synced with the EEPROM to persist the data.
For this whole process I've been given a codebase which includes a SerialCommands.h library.
ProblemThe main problem is that setting values takes up way too much time and breaks the serial buffer (or something similiar) if other commands are executed immediatly after setting. I've written a few unit tests in python (using pyserial
) that execute get requests (such as ?threshold
) flawlessy, as often as possible. However, If I execute a set command (such as !threshold 1400
) I need to wait AT LEAST four seconds before making any other requests, otherwise the serial interface/buffer seems to lose some data. The same thing happens if I try to make any set -> get requests on the Arduino Serial Monitor. Here is a short example:
?threshold
=> returns '1400'!threshold 1234
?threshold
=> nothing happens?threshold
=> nothing happens?threshold
=> returns 'unrecognized command???threshold
' (see my code for this functionality)
EDIT: Something important which I forgot to mention. After the program has recovered (after step 5) the value can be queried correctly.
?threshold
=> returns '1234'
I also have a blinking status LED (in 500ms steps) and if I set something the blinking stops noticeably for around a second.
CodeSo here is (non-working) simplified example of my codebase:
...ANSWER
Answered 2018-Jul-12 at 10:26It sounds like it could be caused by your Python program. Did you remember to add a null-terminator (\0
) after the 1234
integer? Serial commands generally require strings, which must end with a null-terminator. If not your Arduino might keep on waiting for the terminator, and only stops when a timeout occurs or watchdog causes a reset (which could be 4 seconds). That would explain the hold-up.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Arduino-SerialCommand
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page