Newer
Older
Ruby / demo.rb
@SAITO Mitsuki SAITO Mitsuki on 30 Nov 417 bytes 2024-11-30 23:20:07
#!/usr/bin/env ruby
require_relative 'tello.rb'

t = Tello.new

Signal.trap(:INT){
  STDERR.puts "緊急着陸します。"
  t.send_command("land")
  sleep 3
  exit 1
}

t.send_command("command")
print "Enterで離陸:"; gets
t.send_command("takeoff")

print "Enterで前へ300cm:"; gets
t.send_command("forward 300cm")

print "Enterで着陸:"; gets
t.send_command("ccw 90")
sleep 2
t.send_command("land")

t.close