Sha256: 7c3660895d280ccef338f489a560a226d64c882cc4b58a6487e2a4ffe6e5a288

Contents?: true

Size: 580 Bytes

Versions: 22

Compression:

Stored size: 580 Bytes

Contents

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

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

# デジタルの3番、4番、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_cathode('D3').color = 'red'
    sleep(1)
    rgb_led_cathode('D3').color = 'green'
    sleep(1)
    rgb_led_cathode('D3').color = 'blue'
    sleep(1)
    rgb_led_cathode('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_cathode.rb
smalruby-0.1.1 samples/hardware_rgb_led_cathode.rb