SWESTでのmruby ワークショップでの作業。
今日のmrubyコンパイルエラー
chat1.rb
t_ary = [100, 500 1000]
t_idx = 0
while true
if SW() == 0 then
t_idx = (t_idx + 1) %3
end
$t = t_ary[t_idx]
end
chat2.rb
while true
leds_write 1
sleep_ms $t
leds_write 0
sleep_ms $t
end
mruby.ideでの表示
mrubc
mrbc.exe chat1.rb
syntax error unexpected tINTEGE. expecting ']'
カンマが抜けていた。
chat1.rb
t_ary = [100, 500, 1000]
t_idx = 0
while true
if SW() == 0 then
t_idx = (t_idx + 1) %3
end
$t = t_ary[t_idx]
end