Ruby+Serialportã§HEXå¤ãéãã³ã¼ãã§ãã ##ã·ãªã¢ã«ãã¼ãã®æç¡ãç¢ºèª if ARGV.size < 1 puts 'ruby ruby-serialterm.rb /dev/tty/ttyUSB' exit 1 end ##åæå sp = SerialPort.new(ARGV[0], 9600, 8, 1, SerialPort::NONE) ##ãã±ããçæ packet = [0x7E, 0x00, (ä¸ç¥) , 0x1C] ##æ¸ã込㿠#C => 8bitç¡ç¬¦å·æ´æ°ã sp.write(packet.flatten.pack('C*')) æ¸ãè¾¼ã¿ã®ã¨ããã§'H*'ã¨ãã¦ããåå¿ãã¦ããã¾ããã§ããâ¦â¦ã Hã¯16é²æ°è¡¨è¨ã§ãããæååããªã®ã§è»¢éããã¨ASCIIæ±ãã«ãªãã¿ããã§ããã flattenã¡ã½ããã¯å ¥ãåã«ãªã£ã¦ãã¦ãå¼·å¶çã«ä¸æ¬ã®é åã«ãã¦
{{#tags}}- {{label}}
{{/tags}}