Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows support #23

Open
shokai opened this issue Mar 24, 2013 · 9 comments
Open

windows support #23

shokai opened this issue Mar 24, 2013 · 9 comments

Comments

@shokai
Copy link
Owner

shokai commented Mar 24, 2013

No description provided.

@shokai
Copy link
Owner Author

shokai commented Apr 4, 2013

そもそもone click ruby installerとactive script rubyのどっちを使うべきなのかわからない

@shokai
Copy link
Owner Author

shokai commented Apr 4, 2013

http://rubyinstaller.org これがstandardっぽい

@takaokouji
Copy link

Windows対応はどのような作業を想定されていますか?動作確認でいいのでしたら、私のほうでArduino UNOをつかってやりますよ~

@shokai
Copy link
Owner Author

shokai commented Aug 25, 2014

おお!ありがとうございます

  • gem install arduino_firmata でインストールできる
    • serialport gemがC拡張を使っているので、そこがwindowsで通るのか心配
  • リポジトリをgit cloneしてbundle installできる
  • rake testが通る
  • samplesのled_blink.rbでLEDが点滅する
  • samplesのanalog_read_write.rbでアナログ値(0〜1023の値)が標準出力される

ができれば、たぶんその環境で動くと言っても過言ではないと思います

@takaokouji
Copy link

分かりました 👍

ただ、すこし気になったのは、ArduinoFirmata.listは、Windowsだと期待通りには動作しませんね。COM1~99?ですからね。ruby-serialportに、有効なCOMポートのデバイス名を返してくれるようなAPIがあるといいのですけどね~。

@shokai
Copy link
Owner Author

shokai commented Aug 30, 2014

そうですね、それはちょっと気になっていました。
USBデバイスのデバイス名やベンダ名が見れれば便利ですね。ちょっと調べます

@takaokouji
Copy link

少し古い環境 (ruby 2.0.0p481 i386-mingw32) ですが、Windows 8 64ビットにて動作確認をしました。

(1) gem install arduino_firmata でインストールできる
-> OK

>gem install arduino_firmata --no-ri --no-rdoc
Fetching: args_parser-0.2.0.gem (100%)
Successfully installed args_parser-0.2.0
Fetching: event_emitter-0.2.5.gem (100%)
Successfully installed event_emitter-0.2.5
Fetching: arduino_firmata-0.3.7.gem (100%)
Successfully installed arduino_firmata-0.3.7
Parsing documentation for args_parser-0.2.0
Installing ri documentation for args_parser-0.2.0
Parsing documentation for event_emitter-0.2.5
Installing ri documentation for event_emitter-0.2.5
Parsing documentation for arduino_firmata-0.3.7
Installing ri documentation for arduino_firmata-0.3.7
3 gems installed
# serialport gem は MinGW 用をバイナリで配布されているのでコンパイルせずにインストールできました。

(2) リポジトリをgit cloneしてbundle installできる
-> OK

>git clone https://github.com/shokai/arduino_firmata.git
>bundle install
DL is deprecated, please use Fiddle
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Installing rake 10.1.0
Using args_parser 0.2.0
Using event_emitter 0.2.5

Gem::InstallError: The 'serialport' native gem requires installed build tools.

Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
An error occurred while installing serialport (1.2.3), and Bundler cannot
continue.
Make sure that `gem install serialport -v '1.2.3'` succeeds before bundling.

# DevKitを用意して再実行する
>bundle install
DL is deprecated, please use Fiddle
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Using rake 10.1.0
Using args_parser 0.2.0
Using event_emitter 0.2.5
Installing serialport 1.2.3
Using arduino_firmata 0.3.7 from source at .
Installing backports 3.3.4
Using bundler 1.6.3
Installing minitest 5.0.8
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.

(3) rake testが通る
-> NG、ただし想定通り

Standard Firmataを書き込んだArduino UNOを用意。

Windowsではシリアルポートの自動認識は正しく動作しないので、
ENV['ARDUINO'] = 'COM6'
test/test_helper.rbで設定した。(実は、私はWindowsで一時的に環境変数を設定する方法を把握していない (^^;; )

Arduinoを接続した状態で、
>bundle exec rake test
DL is deprecated, please use Fiddle
DL is deprecated, please use Fiddle
Run options: --seed 46572

# Running:

.........E.F

Finished in 42.672393s, 0.2812 runs/s, 2.2263 assertions/s.

  1) Error:
TestClassMethods#test_arduino_list:
Errno::ENOENT: No such file or directory - /dev
    C:/Users/kouji/work/arduino_firmata/arduino_firmata/lib/arduino_firmata/main.rb:4:in `open'
    C:/Users/kouji/work/arduino_firmata/arduino_firmata/lib/arduino_firmata/main.rb:4:in `entries'
    C:/Users/kouji/work/arduino_firmata/arduino_firmata/lib/arduino_firmata/main.rb:4:in `list'
    C:/Users/kouji/work/arduino_firmata/arduino_firmata/test/test_classmethods.rb:6:in `test_arduino_list'


  2) Failure:
TestSysex#test_sysex_command [C:/Users/kouji/work/arduino_firmata/arduino_firmata/test/test_sysex.rb:30]:
Failed assertion, no message given.

12 runs, 95 assertions, 1 failures, 1 errors, 0 skips
rake aborted!
Command failed with status (1): [ruby -I"lib" -I"C:/smalruby-installer-for-windows-master_old/Ruby200_32/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib" "C:/smalruby-installer-for-windows-master_old/Ruby200_32/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/rake_test_loader.rb" "test/test_*.rb" ]

Tasks: TOP => test
(See full trace by running task with --trace)

1つ目のエラーは想定通り。Windowsでは/devはない。

2つ目の失敗は、OSXでも同様だった。 arduino_firmata の問題だと思う。

(4) samplesのled_blink.rbでLEDが点滅する
-> OK

>bundle exec ruby samples\blink_led.rb COM6
# LEDが点滅しました

(5) samplesのanalog_read_write.rbでアナログ値(0〜1023の値)が標準出力される
-> OK

>bundle exec ruby samples\analog_read_write.rb COM6
# Cdsをつないでセンサーの値が正しく出力されることを確認しました

余談ですが、拙作 Smalrubot (Arduino Diecimila or Duemilanove w/ ATmega168P互換機) での動作確認を行いましたが、こちらは StandardFirmata が正しく動作しないようです。
OSX でもダメでしたし、http://www.firmata.org/wiki/Main_Page#Firmata_Test_Program から取得できるテストプログラムでも動作しませんでした。

@takaokouji
Copy link

http://forum.arduino.cc/index.php?topic=201115.0 の最後のコメントから ATMega168P だと StandardFirmata は動作しないようですね 😅

@shokai
Copy link
Owner Author

shokai commented Jan 22, 2015

ありがとうございます。windowsでも基本的には動くみたいですね。
serialport gemの中を見た感じ、使えるCOMポート名のリストを取得する方法は無かったです。

テストのエラー

すみません (3) rake testが通る の2つ目のエラーですが、このファームウェアを使わなければならないのでした。
sysex命令をテストできるように処理を追加しているファームウェアです。

ATmega168

Standard Firmataはけっこう前からサンプルに付いているコードなんですけど、だんだんサイズが大きくなってて、古いArduinoだとプログラムメモリから溢れてしまうみたいですね。

todo

あとでやります

  • テスト実行前にwindowsでもシリアルポート名を設定できるようにする
  • READMEに、windows(MinGW)でも動く事を書く
    • ただしシリアルポート名の自動解決はできない

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants