Sha256: 3bbc6a1646f93fd9c867eb8e6493e080839c628c3b335b4065ef29e61c6e31db
Contents?: true
Size: 542 Bytes
Versions: 10
Compression:
Stored size: 542 Bytes
Contents
module ArduinoFirmata def self.list Dir.entries('/dev').grep(/tty\.?(usb|acm)/i).map{|fname| "/dev/#{fname}"} end def self.connect(serial_name=nil, params={}, &block) serial_name = self.list[0] unless serial_name raise Error.new 'Arduino not found' unless serial_name Params.default.each do |k,v| params[k] = v unless params[k] end arduino = Arduino.new serial_name, params unless block_given? return arduino else arduino.instance_eval &block arduino.close end end end
Version data entries
10 entries across 10 versions & 1 rubygems