Pass parameters on cmd line; getopt ?

I want to pass multiple parameters to my program from the command line. Something similar to getopt. Has anyone put a getopt function or something like it for Arduino?


Well, it’s not exactly getopt(), but a similar approach: you might consider using Bitlash on the Arduino, and extending it with your own application-specific code.

Bitlash is an interpreted language shell that runs on the Arduino. It’s available at as open source. There is a blog posting here that shows how to integrate your own C functions into Bitlash:

The bottom line is that it’s easy to use Bitlash to do all the text parsing and expression handling, and pass the results to the code you add as a User Function. So you could add a function named foo(), and then call it from the serial monitor in the obvious way:

> foo(1,2,3)

Of course you can use the Bitlash expression interpreter as well:

> i=0; while i++<10: foo(i, i*i, D8); delay(100)

All for the price of learning to integrate a little foo :wink:


I will check it out