Code Monkey home page Code Monkey logo

Comments (9)

shokai avatar shokai commented on July 3, 2024

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

from arduino_firmata.

shokai avatar shokai commented on July 3, 2024

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

from arduino_firmata.

takaokouji avatar takaokouji commented on July 3, 2024

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

from arduino_firmata.

shokai avatar shokai commented on July 3, 2024

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

  • 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の値)が標準出力される

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

from arduino_firmata.

takaokouji avatar takaokouji commented on July 3, 2024

分かりました 👍

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

from arduino_firmata.

shokai avatar shokai commented on July 3, 2024

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

from arduino_firmata.

takaokouji avatar takaokouji commented on July 3, 2024

少し古い環境 (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 から取得できるテストプログラムでも動作しませんでした。

from arduino_firmata.

takaokouji avatar takaokouji commented on July 3, 2024

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

from arduino_firmata.

shokai avatar shokai commented on July 3, 2024

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

テストのエラー

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

ATmega168

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

todo

あとでやります

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

from arduino_firmata.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.