View Single Post
  #4   Spotlight this post!  
Unread 30-01-2014, 14:35
tr6scott's Avatar
tr6scott tr6scott is offline
Um, I smell Motor!
AKA: Scott McBride
FRC #2137 (TORC)
Team Role: Mentor
 
Join Date: Dec 2007
Rookie Year: 2005
Location: Oxford, MI
Posts: 531
tr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond repute
Re: Batch program to connect to robot and back

Looks nice, needs mgerber fix, I think.

Here is ours, I only share, as we have multiple bots in testing phases, and we assign team numbers close to ours, may make you think about adding that option.

We also have an option to go do the dlink default address, but with the configuration program, that manual setting of the wireless is not cumbersome.

Code:
@ECHO off
cls
:start
echo.
echo ***********************
echo *** TORC Network    ***
echo *** Interface IP    ***
echo *** Setting Tool    ***
echo ***********************
echo * SAM ver2 8/30/2012  *
echo ***********************
echo.
ECHO 1. Set Network Interfaces to DHCP
ECHO 2. Set Network to 192.168.0.51 dlink default 192.168.0.50
ECHO 3. Set Network to 10.21.36.x Testing Robot (Arduino Bot uses .35 .36)
ECHO 4. Set Network to 10.21.37.x Competition Robot
ECHO 5. Set Network to 10.21.38.x Testing Robot
ECHO 6. Set Network to 10.21.39.x Testing Robot
ECHO 7. Set Network to 192.168.1.x Arduino Bot
ECHO.
set /p choice=Type the number to select option.
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='1' goto dhcp
if '%choice%'=='2' goto 192
if '%choice%'=='3' goto 36
if '%choice%'=='4' goto 37
if '%choice%'=='5' goto 38
if '%choice%'=='6' goto 39
if '%choice%'=='7' goto Arduino
ECHO "%choice%" is not valid please try again
ECHO.
goto start
:dhcp
echo.
echo ***********************
echo *** Setting Wired   ***
echo *** and Wireless to ***
echo ***      DHCP       ***
echo ***********************
echo.
netsh interface ip set address name="Local Area Connection" dhcp
netsh interface ip set address name="Wireless Network Connection" dhcp
ipconfig /release
ipconfig /renew
goto end
:192
echo.
echo ***********************
echo *** Setting Wired   ***
echo ***  192.168.0.51   ***
echo *** and Wireless to ***
echo ***  192.168.0.52   ***
echo ***********************
echo.
netsh interface ip set address name="Local Area Connection" source=static addr=192.168.0.51 mask=255.255.255.0
netsh interface ip set address name="Wireless Network Connection" source=static addr=192.168.0.52 mask=255.255.255.0
goto end
:36
set /p choice=Type the number of last IP value range 10 to 99.
rem if not '%choice%'=='' set choice=%choice:~0,1%
set /a choice1=%choice% + 1
echo.
echo ***********************
echo *** Setting Wired   ***
echo ***  10.21.36.%choice%    ***
echo *** Wireless to     ***
echo ***  10.21.36.%choice1%    ***
echo ***********************
echo.
netsh interface ip set address name="Local Area Connection" source=static addr=10.21.36.%choice% mask=255.255.255.0
netsh interface ip set address name="Wireless Network Connection" source=static addr=10.21.36.%choice1% mask=255.255.255.0
goto end
:37
set /p choice=Type the number of last IP value range 10 to 99.
rem if not '%choice%'=='' set choice=%choice:~0,1%
set /a choice1=%choice% + 1
echo.
echo ***********************
echo *** Setting Wired   ***
echo ***  10.21.37.%choice%    ***
echo *** Wireless to     ***
echo ***  10.21.37.%choice1%    ***
echo ***********************
echo.
netsh interface ip set address name="Local Area Connection" source=static addr=10.21.37.%choice% mask=255.255.255.0
netsh interface ip set address name="Wireless Network Connection" source=static addr=10.21.37.%choice1% mask=255.255.255.0
goto end
:38
set /p choice=Type the number of last IP value range 10 to 99.
rem if not '%choice%'=='' set choice=%choice:~0,1%
set /a choice1=%choice% + 1
echo.
echo ***********************
echo *** Setting Wired   ***
echo ***  10.21.38.%choice%    ***
echo *** Wireless to     ***
echo ***  10.21.38.%choice1%    ***
echo ***********************
echo.
netsh interface ip set address name="Local Area Connection" source=static addr=10.21.38.%choice% mask=255.255.255.0
netsh interface ip set address name="Wireless Network Connection" source=static addr=10.21.38.%choice1% mask=255.255.255.0
goto end
:39
set /p choice=Type the number of last IP value range 10 to 99.
rem if not '%choice%'=='' set choice=%choice:~0,1%
set /a choice1=%choice% + 1
echo.
echo ***********************
echo *** Setting Wired   ***
echo ***  10.21.39.%choice%    ***
echo *** Wireless to     ***
echo ***  10.21.39.%choice1%    ***
echo ***********************
echo.
netsh interface ip set address name="Local Area Connection" source=static addr=10.21.39.%choice% mask=255.255.255.0
netsh interface ip set address name="Wireless Network Connection" source=static addr=10.21.39.%choice1% mask=255.255.255.0
goto end
:Arduino
set /p choice=Type the number of last IP value range 10 to 99, excluding 20 and 21.
rem if not '%choice%'=='' set choice=%choice:~0,1%
set /a choice1=%choice% + 1
echo.
echo ***********************
echo *** Setting Wired   ***
echo ***  192.168.1.%choice%   ***
echo *** Wireless to     ***
echo ***  192.168.1.%choice1%   ***
echo ***********************
echo.
netsh interface ip set address name="Local Area Connection" source=static addr=192.168.1.%choice% mask=255.255.255.0
netsh interface ip set address name="Wireless Network Connection" source=static addr=192.168.1.%choice1% mask=255.255.255.0
goto end
:end
echo.
echo ************************
echo ***    All Done      ***
echo ************************
echo.
@pause
exit
__________________
The sooner we get behind schedule, the more time we have to catch up.