Comments (5)
it is not working for me always (sometimes does:)) but mostly i got error:
Errno::EAGAIN: Resource temporarily unavailable - write would block
running on 1.9.3 but tried on 1.9.2 also
from arduino_firmata.
thank you for report. I'll check it.
from arduino_firmata.
on Linux OS, dissable nonblocking IO
arduino = ArduinoFirmata.connect '/dev/tty.usb-device-name', :nonblock_io => false
from arduino_firmata.
I have been playing around with this gem and have been having trouble with the sinatra script.
$:.unshift File.expand_path '../lib', File.dirname(__FILE__)
require 'rubygems'
require 'sinatra'
require 'eventmachine'
require 'arduino_firmata'
arduino = ArduinoFirmata.connect nil, :nonblock_io => true
arduino.pin_mode 13, ArduinoFirmata::OUTPUT
get '/' do
redirect './on'
end
get '/on' do
arduino.digital_write 13, true
"<p><a href='./off'>LED OFF</a></p>"
end
get '/off' do
arduino.digital_write 13, false
"<p><a href='./on'>LED ON</a></p>"
end
This is the code I'm currently using, which does end in a sinatra page and supposed connection altough the led doesn't light up when I go to /on. I did remove :eventmachine => true because it was causing an error but I don't think it was even used in this code.
I have also tried setting :nonblock_io to false but then the ruby script just gets stuck at this line:
arduino = ArduinoFirmata.connect 'dev/tty.usbmodem1411', :nonblock_io => false
And I have gotten blink led to work. Does it have to do with the fact that I dont have a loop or do I need to use a special firmata for the arduino besides standard_firmata?
from arduino_firmata.
The sinatra example it only works if I connect to the arduino each call like:
get '/on' do
arduino = ArduinoFirmata.connect
analog = arduino.analog_read(0)
arduino.digital_write 13, ArduinoFirmata::HIGH
"<p>analog : #{analog}</p><p><a href='./off'>LED OFF</a></p>"
end
get '/off' do
arduino = ArduinoFirmata.connect
analog = arduino.analog_read(0)
arduino.digital_write 13, ArduinoFirmata::LOW
"<p>analog : #{analog}</p><p><a href='./on'>LED ON</a></p>"
end
which is not correct.
I can't figure out what is wrong, I tried to update firmata but nothing happend.
from arduino_firmata.
Related Issues (20)
- throw Error "device not found"
- evetmachine
- windows support HOT 9
- debouncing of on :analog_read HOT 1
- share an arduino with dRuby HOT 3
- share an arduino between multiple processes
- set pin_mode before analog_read HOT 3
- Performance and annoying sound
- Arduino.on(:digital_read) returns pin value of 0 HOT 4
- check arguments (negative values)
- analog_read not works on Arduino UNO
- 10 second delay before using Arduino Mega 2560
- Process never exits
- cannot detect :digital_read with pin-8
- Initialization hangs without nonblock_io option
- [Arduino] Serialport not open
- Continuous reading from analog pin gets the same value HOT 1
- reading i2c sensors
- Sysex test is failing HOT 1
- Can't run tests with `ruby-2.2.2`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduino_firmata.