Slide 67
Slide 67 text
QR reader
require 'net/http'
require 'uri'
require 'serialport'
HOST = 'http://localhost:9292/qr_reader'
SerialPort.open('/dev/ttyACM0', 38400, 8, 1, SerialPort::NONE) do |com|
while true
begin
str = com.gets
body = {
input: str
}
Net::HTTP.post_form(URI.parse(HOST), body)
rescue => e
p e
end
end
end