Jump to content
Sign in to follow this  

arduino command line tool

Recommended Posts

Hello guys. Its strange, but nobody here talk about Arduino. For me Arduino is the ultimate physical automation platform - if you don't know what is it - use google and you will be impressed.

I already use Autoit to communicate with my Arduino board via serial port and everything was fine.

I have an idea - to create a command line tool that can communicate with Arduino in real time.

For Example:

tool.exe digitalport 10 output HIGH will change the output of the port 10 and some LED will be ON, or relay or whatever you want.

tool.exe analogport 5 read will read the current from this port

I think it is really possible. A lot of work, but possible. Will need to create AutoIt code and C code for it. When you upload the C code you will be able to use such application. If you have command line based Arduino control tool, you can create everything to control arduino or to detect sensor information, like light, gas, ultrasound swich etc.

If you have ideas how to do this we can cooperate and just do it. :)

Share this post

Link to post
Share on other sites

Hello, I have an Arduino Uno! Duemilanove!

Glad you looking for it. I've been testing a sketch that, when it has running smoothly I'll post.

Posted Image

Edited by jscript

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram


dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Share this post

Link to post
Share on other sites

You know Arduino is not just a robot platform.

For me this is the ultimate sensor interface to PC or to Arduino itself. And there is so many thinks that you can automate with sensors. Cost me 10 minutes to set arduino+autoit to send me sms every time when becames dark (its not useful with light sensor, but motion sensor or temp sensor - why not? :) )

Share this post

Link to post
Share on other sites

OK. Here is my first step. Very simple command line tool that prepare commands to be sent true serial to arduino board.

The syntax is very close to the original arduino commands. Some examples:

comduino digitalWrite 10 HIGH

comduino digitalWrite A3 LOW

comduino analogRead 5

comduino digitalRead 5

This is the full list of commands actually - just digitalwrite, digitalread and analogwrite. With these 3 simple commands you can control all pins and all environment connected to the board

You can use analog ports as digital - the script will check for this. There is some basic debug information and error messages if you put something wrong. You can see some serial communication related lines. I will use ini file for serial port configuration.

Please comment! :)

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include 'CommMG.au3'

Global $CMPort = 25             ; Port
Global $CmBoBaud = 9600         ; Baud
Global $CmboDataBits =  8       ; Data Bits
Global $CmBoParity = "none"     ; Parity
Global $CmBoStop = 1            ; Stop
Global $setflow = 2             ; Flow
Global $sportSetError = ''

_CommSetPort($CMPort, $sportSetError, $CmBoBaud, $CmboDataBits, $CmBoParity, $CmBoStop, $setflow)

if $cmdLine[0] < 2 Then
    ConsoleWrite($cmdLine[0] & "Wrong number of parameters. You need at least command and pin parameter to run this program")

if $cmdLine[0] > 2 then


;Check da command parameter
if StringInStr($cmdCommand,"digitalread",0) <> 0 Then
ElseIf StringInStr($cmdCommand,"digitalwrite",0) <> 0 Then
ElseIf StringInStr($cmdCommand,"analogread",0) <> 0 Then
    ConsoleWrite("wrong command parameter. Use digitalRead, digitalWrite or AnalogRead")

;Check the type of pin
if stringinstr($cmdPin,"A",0)=0 Then


;Check if pin is integer
if IsInt($pin)=0 Then
    ConsoleWrite("Pin Parameter is not an Integer. Example for pin parameter - 1,2,3 or if you need to use analog pin as digital - A1,A2,A3")

;Check if pin is positive
if $pin<0 Then
    ConsoleWrite("Pin parameter can't be negative. Example for pin parameter - 1,2,3 or if you need to use analog pin as digital - A1,A2,A3")

;IF the command is digitarwrite, read the write parameter... haha :)
if $command=2 then
    if StringInStr($cmdWrite,"high",0) <> 0 Then
    Elseif StringInStr($cmdWrite,"low",0) <> 0 Then
        ConsoleWrite("Wrong write parameter. Use HIGH and LOW only")

ConsoleWrite("Command: " & $command & ", PIN: " & $PIN & ", Write: " & $write & ", PinType: " &  $pinType)

Edited by littleclown

Share this post

Link to post
Share on other sites

Hi again.Maybe http://bitlash.net/wiki/start can be the code from Arduino side. This is a language that can be triggered directly from serial port connection. Now I try to run the test :).

EDIT: I test it and works just great.

The short story: bitlash is a library that can be used to communicate with Arduino from serial port.

For example if you send to Arduino using serial connection:

print d13

Will return you the result from digital pin 13. But bitlash have a lot of other function. The full list is here: http://bitlash.net/wiki/functions You can send all these function to serial and they will be executed on the board. You can create functions and start it. The function will be written in the EEPROM memoty and will be there even if you power cycle the board.

EDIT 2: There is just no sense to recreate some of the bitlash functions in new commands.

I will just try to find good command line based program to send command to serial port. I found this one: http://www.comp.lancs.ac.uk/~albrecht/sw/terminal/index.html and will se is this work

Edited by littleclown

Share this post

Link to post
Share on other sites

Maybe It can interest You....



small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...