Skip to content
/ cmd Public

Simple Command Processor for Arduino using regex

Notifications You must be signed in to change notification settings

gleandroj/cmd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Cmd Library

Simple Command Processor for Arduino using regex

Dependencies

How To Use This Library



/* Callback's*/
#include <Cmd.h>

void _testCmd(MatchState *ms);

/* Command's */
Command_t cmds[] =
{
  { "^test cmd (%d+)$", _testCmd },
  { NULL, NULL }
};

Cmd* cmdParser;

void setup()
{
  Serial.begin(9600);
  cmdParser = new Cmd(&cmds[0]);
}

void loop()
{
   cmdParser->process(Serial.readString());
}

void _testCmd(MatchState *ms)
{
  if (ms->level > 0)
  {
    char cparameter[10];
    ms->GetCapture(&cparameter[0], 0);
    int parameter = atoi(&cparameter[0]);
    Serial.println(paramter);
  }
};


About

Simple Command Processor for Arduino using regex

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages