How to run script without downloading all the files

Hi I have created a project using blynk with Arduino designed to be connected to a PC through the serial USB port.
I want to be able to send the Arduino to a friend and allow them to use their pc to connect the Arduino to the internet so that I can control it using blynk.

The project works fine when I run it on my pc, by running the blynk-ser.bat file to connect.

I tried copying this file to my desktop thinking that I would need to send this file to my friend to enable him to run the script when he connects the Arduino that I am sending him … but it doesn’t run - I am concerned that it won’t run in isolation for him too -is this the case ?
Is it going to be necessary for him to download Arduino ide and the blynk folders in order to navigate to the scripts directory and run the blynk-ser.bat file ? Is there an easier way to allow him to connect, using a web page that I could set up for him for example? Thanks in anticipation
Charlie

If you look at the contents of the batch file you’ll see that it requires com2tcp.bin to be present in the same folder as the batch file, and that the first time it is run then it will create com2tcp.exe in the same location.

Pete.

Hi Pete, thanks for your post. I looked at the batch file and regrettably couldn’t determine what you were able to from your understanding of these things. I really appreciate you providing your reply / advice. I tried what you suggested and it works perfectly with just the 2 files, as you said it would. In passing I had difficulty emailing these files in outlook- for security reasons so I intend to let my friend download from my website. Instead of this, Pete, do you think it might be feasible to run this batch file from a website link. I really do wish I had studied all this at school / university. When I was at university we had 1 computer - an IBM mainframe that generated 75kw of heat ! Thanks again for your very helpful comment.

rem Create exe
if not exist "%SCRIPTS_PATH%\com2tcp.exe" (
    copy "%SCRIPTS_PATH%\com2tcp.bin" "%SCRIPTS_PATH%\com2tcp.exe" > NUL
)

This bit of the script code is saying that if the batch file can’t find a file called `com2tcp.exe’ in same folder that you’re running the script from then create the file by renaming the com2tcp.bin file.

This bit of the script is then launching the .exe file using the parameters from the batch file:

:restart
  "%SCRIPTS_PATH%\com2tcp.exe" --baud %COMM_BAUD% --ignore-dsr \\.\%COMM_PORT% %SERV_ADDR% %SERV_PORT%
  echo Reconnecting in 3s...
  timeout /T 3
goto restart

The best place to download the files from is here:

Have you considered using a NodeMCU type board instead, and connecting via WiFi?
You can use libraries such as WiFi manager to allow people to input their own WiFi credentials, and Blynk Auth code if necessary, via a captive portal web page on their mobile phone.

Ah yes, the joys of queuing to use the single PDP11 green screen terminal and keying-in your code then compiling it to discover that you have 950 warnings and 75 fatal errors in your 10 lines of code, because you missed out a comma in the first line :crazy_face:

Pete.

Good day Pete, Thanks for your note about Node MCU and WiFi manager. I had originally considered the ESP8266 but discovered that I would need to include my friend’s SSID and password in the sketch and I didn’t want to ask him for that. It also looked difficult to use. So I then considered GSM, but the SIM900 board I sourced uses 2G and the network in Malaysia (where my friend is) doesn’t support 2G. I then tried Bluetooth but I couldn’t get the HC-06 to pair to my android phone (it said it had paired to my android phone but it kept blinking fast), I discovered that my friend uses an iphone and as IOS isn’t supported I bought a 2G Bluetooth dongle but couldn’t get that to pair either. It was then I was left with the serial USB connection but have the inconvenience of the script and I don’t really want to ask him to run a script. So now, 4 weeks on, I find myself back where I started with your excellent suggestion of what looks to be exactly what I need – NodeMCU & WiFi manager. I have been researching this and it looks like this will enable him to enter his SSS and password from a web page that I create when he turns the unit on.
I have bought the ESP 8266 ESP-12E and the ESP 32 versions for test. I am intending to start a new sketch selecting the ESP8266_Shield example from the Arduino IDE>Boards WiFi and then add in the WiFi manager bit. I understand that there are downloads that I will need from github. Just one question Pete, and I am sure that your valued answer one way or the other could make my weekend either most satisfying or extremely frustrating… …am I on the right lines ? I have very fond memories walking to the Claremont Tower early in the morning with a deck of printed cards wrapped in listing paper and a rubber band to a card reader so that I could pick up the output later that day. I always had the odd “BEGIN” and “END;” card to hand for my ALGOLW programmes !

I think the ESP shield example is aimed at using the ESP8266 (usually the basic ESP-01 version) as a WiFi modem for an Arduino Uno is similar. This uses AT commands to talk to the ESP and expects the ESP to be running the factory AT firmware (which will overwritten as soon as you upload a sketch).

There are some excellent examples of ready to go code on the WiFiManager GitHub site. There is also an alternative library written by forum user @khoih that also has ready to use examples.

I never used punch cards myself, but I bet most people won’t know what they’re for nowadays :smiley:

Pete.