Sha256: 7ce0f458528fe626caf1e93fc51bf82318a76d84a1f82630524904569692d470

Contents?: true

Size: 591 Bytes

Versions: 22

Compression:

Stored size: 591 Bytes

Contents

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

DESCRIPTION = <<EOS
RGB LED(アノードコモン)の色を変化させます
EOS

# デジタルの3番、4番、5番、6番ピンにそれぞれR、コモン、G、Bを接続してく
# ださい。

require 'smalruby'

init_hardware

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

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

  loop do
    rgb_led_anode('D3').color = 'red'
    sleep(1)
    rgb_led_anode('D3').color = 'green'
    sleep(1)
    rgb_led_anode('D3').color = 'blue'
    sleep(1)
    rgb_led_anode('D3').turn_off
    sleep(1)
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
smalruby-0.1.1-x86-mingw32 samples/hardware_rgb_led_anode.rb
smalruby-0.1.1 samples/hardware_rgb_led_anode.rb