Go Down

Topic: Using .HTA as GUI for UNO (Read 303 times) previous topic - next topic

GrimBot

Hello, I have an Arduino Uno and would like to control the Arduino Uno on Com Port 3 using buttons made in a .HTA file. 

Aside from buttons that are clicked and move the attached hardware in increments if possible I'd like to also be able to load Motion Path files in the .HTA and have those motion paths replayed.

I've looked online for tips on this but I don't think my searching terms were technical enough to get me to the info I'm looking for.

GrimBot

I'm still trying to figure this out but here is a thought I'm working out.

With the .hta files, it is easy enough for me to run .bat files with a click of a button. I've read on some pages that Arduino also has command line options. I'm currently not sure if it's command line input, or command line output, or both.

 So, maybe a drop down menu to select with servo or pin the controls would control and, for example, a "Left Button" that moves servo 1, left by a specified amount of degrees, at a click of a button by calling a bat file that is ran when the button is pressed might work right? Maybe the drop down menu option for the servo or pin select is complicating things too much. 

Like I said, I'm still trying to figure this out but I'm hoping this rambling will help someone if they get around to explaining how to do what I'm talking about. 

PaulS

Quote
Hello, I have an Arduino Uno and would like to control the Arduino Uno on Com Port 3 using buttons made in a .HTA file. 
What application creates/uses .HTA files? Can that application open the serial port?

Quote
and have those motion paths replayed.
While the Arduino blinks some LEDs?

Quote
I've read on some pages that Arduino also has command line options.
Where? The Arduino doesn't have "a command line".

GrimBot

#3
Dec 14, 2015, 02:49 pm Last Edit: Dec 14, 2015, 02:56 pm by GrimBot
Paul S, ".hta" is like a website that runs like an application / .exe file.

see more:  http://fileinfo.com/extension/hta


 I've seen people do some VB stuff with it, but I personally haven't. I've used it for stuff such as running .bat files or doing stuff with command line utilities that required switches so I'd make a button like "record 20 mins" so when I would click the button it would run a dos audio editor with all the switches and specified time limits. Or I would have macros triggered using a click of a button and the collection of them set up inside the .hta file.   I'm more comfortable with web design, so instead of addressing my problems by diving into learning a whole other programming language, I'd prefer to see if I can work with what I know, at least know a little more about. It doesn't always work out that way though..


I see this guy has found a way to "Control Arduino LEDs from the windows command line"

https://www.youtube.com/watch?v=wypyrgvDYOo

The links to get the code and such seem to point to him using "CmdMessenger"

http://playground.arduino.cc/Code/CmdMessenger

Additional searches for using Arduino with command line lead me here:

http://playground.arduino.cc/Learning/CommandLine


This stuff is looking like it is still over my head but at least I see a video of someone getting hardware reactions from Arduino using command line stuff, so my goal of an .HTA file as a GUI doing stuff with .bat files doesn't look like it is impossible to do.


I am still unsure if I need to upload some specific sketch to the arduino to make it work with command line stuff, or if it is just controlling it without needing a sketch uploaded.

If this "CmdMessenger" thing can do stuff with .bat files, maybe I can do some kind of motion path and add "sleep", or some other delay command into the .bat file so it isn't throwing every command at the arduino at once.


info on using waiting in .bat files: http://www.robvanderwoude.com/wait.php

I'm still trying to figure it out and haven't actually done any "use .hta to control arduino via cmd". There is probably more efficient ways of going about this by using the arduino IDE, but that is currently out of my ability, and working with .hta at least keeps me a little closer to working within my comfort zone.

I hope this information helps anyone trying to figure out how to do this. If you find the solution and could share the handful of links to bring it all together.... post and yay. :)


PS: what got me on this tangent is I wanted to play with one of those "mearm" robot arms using the "mecon" software. Built the arm, plugged everything in, but the software doesn't work and I can't find support for it so now I need to figure it out. Maybe the software does work and I just don't get the concept of how to link the hardware with the software but yeah...  I wish this mecon thing worked so I could play with this arm.   http://microbotlabs.com/mecon-robot-controller.html

GrimBot

I still haven't done it personally, but this looks like it will be a helpful video when trying to get the .hta file to run the arduino by using command line stuff and .bat files.

video:  https://www.youtube.com/watch?v=ogHvY5GwgZI

The tutorial description text is all in Russian, but I ran it through a translator and will post it here.

I'm still wondering if I will need to load a sketch onto the arduino itself to link the hardware to the software or if the .bat files are just messing with the hardware without using the arduino program.

Also, blinking a light is fun, but I'm wondering how tough its going to be to put together a motion or other kinds of command send/receive events using a .bat file.   I've seen something where people were recording servo feedback and exporting it to excel files, but I don't know yet if that translates into anything I could use without doing a lot of correcting.


Here is the translation to this video:  https://www.youtube.com/watch?v=ogHvY5GwgZI
--------------

Arduino control via com port from the command prompt or a bat file
Arduino control via com port from the command line or a bat file

1. Create a text file with a .txt extension
2. to copy

Mode COM4,9600, n, 8,1, P
ECHO 1 $ COM4
ping -n 3 127.0.0.1 $ nul
ECHO 1 $ COM4
ping -n 3 127.0.0.1 $ nul
ECHO 1 $ COM4


REM delay, you can make a ping -n 5 127.0.0.1 $ nul 5 - a second

3. To change the file extension .bat, and run it


//
The serial ports are named "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9". For access to ports whose number is greater than 9, you must specify the name of the port as a \\. \ COMx where x - the port number. For example, "\\. \ COM72".

ECHO 1 $ \\. \ COM11
//

ready examples bat file
http://yadi.sk/d/mOhWKJ-x5l12K

Syntax BAT-files and command line under MS-DOS
http: //www.ossite.ru/? dir = os / dos / & ...


Programming of COM port
http://www.softelectro.ru/rs232prog.html

Using MS-DOS commands
On MS-DOS has a number of built-in commands to operate and configure the COM port. Commands can be inserted in a batch file with the .bat extension to execute them in a given scenario.

The MODE command
Command Mode is used to change the mode of operation of peripheral devices. Format:

Mode COMx, baud, parity, frame, freeze, P where: x-COM port number;
bod- speed: 110,150,300,600,1200,2400,4800,9600,19200 baud;
parity-n-no, o-parity, e-odd;
kadr- bits per character: 7.8;
stop- number of stop bits: 1.2
P- specifies the mode of transmission retry on failure.
An example of using MS-DOS commands to control the COM port:
Create a text file (such as Notepad) Test.txt
Write it lines and save:
Mode COM1,9600, n, 8,1, P
type c: \ data.txt $ com1
Change the file extension from .txt to .bat
Create a text file c: \ data.txt
Record it in a text string and finish line Enter
Run Test.bat
As a result of execution of the batch file Test.bat string recorded in the data.txt file will be transferred to COM1 at 9600 baud, parity check, 8 bits per symbol, with one stop bit.
In this batch file, we used three MS-DOS commands:
Mode- Setting the COM port
Type- output
$ - Redirection
In Windows it is also possible execution of a batch file, but the parameters of commands you want to record a little differently:
mode com1 baud = 9600 parity = n data = 8 stop = 1
type c: \ data.txt $ com1
In addition, in Windows Enter the string end is not necessary.

///////////////////

or as a single file

Command Prompt, Command Prompt, Windows, (CMD), Arduino, control via com port from the command line, bat file, com port, command line, bat file



PaulS

Quote
I'm still wondering if I will need to load a sketch onto the arduino itself to link the hardware to the software or if the .bat files are just messing with the hardware without using the arduino program.
The only way that the PC can make the Arduino do anything is to ask the Arduino to do it. There must be a sketch loaded on the Arduino that understands what the PC is asking.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy