diff --git a/main.rb b/main.rb index bf65dc2..6932ef8 100755 --- a/main.rb +++ b/main.rb @@ -24,7 +24,6 @@ LEDS.each do |led| IO.set_low led end -# IO.reset get '/' do @led_status = led_status @@ -35,11 +34,11 @@ get '/cycle' do clear 5.times do |i| - sleep 0.5 + sleep 0.3 IO.set_high LEDS[i] IO.set_low LEDS[i - 1] end - + sleep 0.3 clear redirect to('/') end @@ -51,6 +50,11 @@ get '/led/:color' do |led| redirect to('/') end +get '/clear' do + clear + redirect to('/') +end + def pick led case led when 'blue' diff --git a/public/main.css b/public/main.css new file mode 100644 index 0000000..26652a9 --- /dev/null +++ b/public/main.css @@ -0,0 +1,42 @@ +html { + box-sizing: border-box; + font-size: 16px; +} + +*, *:before, *:after { + box-sizing: inherit; +} + +.container { + margin: 15px auto; + max-width: 450px; +} + +ul.switches { + display: flex; + margin: 0 0 15px; + padding: 0; + list-style: none; +} + +.switches li { + margin: 5px; +} + +.switches a { + display: inline-block; + padding: 10px; + border: 1px solid #000; + border-radius: 5px; + text-decoration: none; + color: #000; +} + +.switches a:hover { + background-color: #eee; +} + +.switches a.active { + background-color: #858585; + color: #eee; +} diff --git a/views/index.erb b/views/index.erb index 1fe079f..eae5747 100644 --- a/views/index.erb +++ b/views/index.erb @@ -3,21 +3,24 @@