Board index FlightGear Support Interfacing

Expect to Telnet

Connecting two computers, using generic protocol, connecting with Matlab?

Expect to Telnet

Postby drR0ckso » Mon Aug 14, 2017 6:58 pm

Gas up the jet, we got to go!

Code: Select all
#!/usr/bin/expect -f
spawn telnet 127.0.0.1 5050
send "\r"
expect "/> "
send "setf /sim/hud/color/blue 0.0\r"
expect "/> "
send "setf /sim/hud/color/green 0.0\r"
expect "/> "
send "setf /sim/hud/color/red 1.0\r"
expect "/> "
send "set /sim/hud/color/alpha 1\r"
expect "/> "
send "setf /sim/hud/color/brightness 1.5\r"
expect "/> "
send "get /consumables/fuel/tank\[0\]/level-norm\r"
expect "/> "
send "get /consumables/fuel/tank\[1\]/level-norm\r"
expect "/> "
send "get /consumables/fuel/tank\[2\]/level-norm\r"
expect "/> "
send "get /consumables/fuel/tank\[3\]/level-norm\r"
expect "/> "
send "setd /consumables/fuel/tank\[0\]/level-norm 1.0\r"
expect "/> "
send "setd /consumables/fuel/tank\[1\]/level-norm 1.0\r"
expect "/> "
send "setd /consumables/fuel/tank\[2\]/level-norm 1.0\r"
expect "/> "
send "setd /consumables/fuel/tank\[3\]/level-norm 1.0\r"
expect "/> "
send "setf /sim/hud/color/blue 0.22\r"
expect "/> "
send "setf /sim/hud/color/green 1.0\r"
expect "/> "
send "setf /sim/hud/color/red 0.38\r"
expect "/> "
send "quit\r"


$ chmod +x scriptfile.expect
$ ./scriptfile.expect
I speak only for myself.
drR0ckso
 
Posts: 37
Joined: Fri May 12, 2017 4:14 am

Return to Interfacing

Who is online

Users browsing this forum: No registered users and 2 guests