ãã£ã¸ã«ã«ãªæä½ã¨ãããã¯ã¼ã¯ãä»ããã¤ã³ã¿ã©ã¯ã·ã§ã³ããã¢ã¸ã£ã¤ã«ã«ãããã¿ã¤ãããruby-serialportã®ã¤ã³ã¹ãã¼ã«ãå®äºããããrubyããã·ãªã¢ã«éä¿¡ãè¡ãããã¨ã確èªãã¾ãããã 1, arduinoããã»ã³ãµã¼å¤ãrubyã«éã Toolsã¡ãã¥ã¼ > Serial Portã§ãã¼ãçªå·ã確èªãã¾ãã ä¸è¨ã®ãµã³ãã«ã®portã«ãã®ãã¼ãçªå·ãè¨å ¥ãã¦ãã ãã arduino2ruby.rb require 'serialport' port = "/dev/tty.usbserial-***" #arduinoã®ãã¼ãçªå· sp = SerialPort.new(port, 9600, 8, 1, SerialPort::NONE) while (sp.gets) do puts sp.gets end sp.close arduinoå´ã®ã½ã¼ã¹ int ai
{{#tags}}- {{label}}
{{/tags}}