Sha256: b488ec98c0b8dc9f50785137a24234c7dd8e5ba4514266fbafd65c6b028ae8cc

Contents?: true

Size: 652 Bytes

Versions: 10

Compression:

Stored size: 652 Bytes

Contents

# -*- coding: utf-8 -*-

DESCRIPTION = <<EOS
2WD車のタイヤ(モーター)を操作します
EOS

# デジタルの2番・3番ピンに左のモーター、4番・5番ピンに右のモーターを接
# 続してください。

require 'smalruby'

init_hardware

stage1 = Stage.new(color: 'white')

stage1.on(:start) do
  draw_font(string: DESCRIPTION, color: 'black')

  loop do
    two_wheel_drive_car('D6').forward
    sleep(3)
    two_wheel_drive_car('D6').backward
    sleep(3)
    two_wheel_drive_car('D6').turn_left
    sleep(3)
    two_wheel_drive_car('D6').turn_right
    sleep(3)
    two_wheel_drive_car('D6').stop
    sleep(3)
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
smalruby-0.0.29-x86-mingw32 samples/hardware_two_wheel_drive_car.rb
smalruby-0.0.29 samples/hardware_two_wheel_drive_car.rb
smalruby-0.0.28-x86-mingw32 samples/hardware_two_wheel_drive_car.rb
smalruby-0.0.28 samples/hardware_two_wheel_drive_car.rb
smalruby-0.0.27-x86-mingw32 samples/hardware_two_wheel_drive_car.rb
smalruby-0.0.27 samples/hardware_two_wheel_drive_car.rb
smalruby-0.0.26-x86-mingw32 samples/hardware_two_wheel_drive_car.rb
smalruby-0.0.26 samples/hardware_two_wheel_drive_car.rb
smalruby-0.0.25-x86-mingw32 samples/hardware_two_wheel_drive_car.rb
smalruby-0.0.25 samples/hardware_two_wheel_drive_car.rb