first noodles

This commit is contained in:
Mark Moser 2019-01-27 19:59:09 +00:00
parent 9519c85e7b
commit cbcf60a3ed
3 changed files with 56 additions and 0 deletions

8
Gemfile Normal file
View File

@ -0,0 +1,8 @@
# frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
# gem "sinatra"
gem 'rpi_gpio'

13
Gemfile.lock Normal file
View File

@ -0,0 +1,13 @@
GEM
remote: https://rubygems.org/
specs:
rpi_gpio (0.3.3)
PLATFORMS
ruby
DEPENDENCIES
rpi_gpio
BUNDLED WITH
2.0.1

35
main.rb Executable file
View File

@ -0,0 +1,35 @@
# frozen_string_literal: true
#!/usr/bin/env ruby
require 'bundler'
require 'rpi_gpio'
Bundler.setup
Bundler.require
BLUE = 37
WHITE = 35
RED = 33
GREEN = 31
YELLOW = 29
leds = [BLUE, WHITE, RED, GREEN, YELLOW]
io = RPi::GPIO
io.set_numbering :board
leds.each do |led|
io.setup led, as: :output, initialize: :low
io.set_low led
end
10.times do
5.times do |i|
sleep 0.5
io.set_high leds[i]
io.set_low leds[i - 1]
end
end
io.reset