austinbv/dino

Dino can't find board

Closed this issue · 14 comments

I'm following the guide at: http://tutorials.jumpstartlab.com/projects/arduino/introducing_arduino.html

but whenever I try and run a ruby script I get the following error:

/Users/Hami/.rvm/gems/ruby-2.0.0-p247-docs/gems/dino-0.11.2/lib/dino/tx_rx/base.rb:52:in handshake': Dino::BoardNotFound (Dino::BoardNotFound) from /Users/Hami/.rvm/gems/ruby-2.0.0-p247-docs/gems/dino-0.11.2/lib/dino/tx_rx/serial.rb:23:inhandshake'
from /Users/Hami/.rvm/gems/ruby-2.0.0-p247-docs/gems/dino-0.11.2/lib/dino/board.rb:13:in handshake' from /Users/Hami/.rvm/gems/ruby-2.0.0-p247-docs/gems/dino-0.11.2/lib/dino/board.rb:9:ininitialize'
from number_guess_game.rb:3:in new' from number_guess_game.rb:3:in

'

Any ideas on what I can do?

The issue is only happening with an Arduino Mega 2560. No such problem with an UNO.

The little LEDs on the Mega flash when the ruby program is run but then nothing, apart from the error message in Terminal.

Can you post the source for the script that's raising the error?

  require 'dino'

  board = Dino::Board.new(Dino::TxRx.new)
  two_led = Dino::Components::Led.new(pin: 2, board: board)
  three_led = Dino::Components::Led.new(pin: 3, board: board)
  four_led = Dino::Components::Led.new(pin: 4, board: board)
  five_led = Dino::Components::Led.new(pin: 5, board: board)
  six_led = Dino::Components::Led.new(pin: 6, board: board)
  seven_led = Dino::Components::Led.new(pin: 7, board: board)
  eight_led = Dino::Components::Led.new(pin: 8, board: board)
  nine_led = Dino::Components::Led.new(pin: 9, board: board)

  def blink(leds)
    leds.each do |led|
    led.send(:on)
    sleep 0.1
    led.send(:off)
    sleep 0.1
  end
end


  leds = [two_led, three_led, four_led, five_led, six_led, seven_led, eight_led, nine_led]
  20.times { blink(leds) }

Just replicated this with my Mega and 0.11.2. It works with 0.11.3 (currently master). There were some issues with the handshake and pins specific to the Mega that I fixed in 0.11.3. Clone master and try it with that (don't forget to upload the updated sketch), or you can wait for @austinbv to push 0.11.3 to rubygems.org.

Also, this line board = Dino::Board.new(Dino::TxRx.new), should become board = Dino::Board.new(Dino::TxRx::Serial.new). The first will still work, but since we've added a TCP txrx, this is probably the safer way to go.

Thanks for that. Going to 0.11.13 fixed it for me too.

I am getting the same error with 0.12.0.What should I do?

@tworitdash, what board and OS?

Arduino Uno board and Windows 7.. Sorry for the late reply..

On Thu, Jan 9, 2014 at 6:51 PM, Vickash Mahabir notifications@github.comwrote:

@tworitdash https://github.com/tworitdash, what board and OS?


Reply to this email directly or view it on GitHubhttps://github.com//issues/69#issuecomment-31929876
.

Ah, see #66. We'll have to make something like the hack I did in there permanent just to get this working on windows machines. It was there in 0.11.3:

https://github.com/austinbv/dino/blob/master/lib/dino/tx_rx/serial.rb#L18-L24

But I removed it in 0.12, thinking it would work without, but clearly it can't. Just added it back into 0.12: c9f9d7f

Pull 0.12 again, try it and let me know if that works. That said, messages sent from the board back to ruby through the serial connection apparently don't work on windows. There's a new version of the serialport gem recently released:

https://github.com/hparra/ruby-serialport

I don't know if that will fix it, or if the problem is at a lower level in the C extensions, or the windows com port drivers. Try updating to that version of serialport and running the sensor example, to test it? I'd be interested to know what results you get.

Ok. @vickash Listen what I have done today.
I just ran these following lines

gem uninstall dino

then I uninstalled all the versions

Then installed dino gem manually and installed the 0.12.0 after following your comment #55 (comment)

And then

gem uninstall serialport

Then I installed it again

Then I opened up the .ino file from dino_serial folder

Then uploaded it to Arduino Uno.

Then just ran the ruby code

          require 'dino'
          board = Dino::Board.new(Dino::TxRx.new)
          led = Dino::Components::Led.new(pin: 11, board: board)
          [:on, :off].cycle do |switch|
             led.send(switch)
              sleep 0.5
          end 
   

I found no error.

And the information is actually going to the serial port because i observed a slight blinking in the external LED on pin 11 first.But the problem I am facing is that the LED is getting off suddenly and the blinking is not taking place. I guess this is not a hardware problem as the blinking code using only serial port gem is working on 11th pin.
I am a beginner in both ruby and arduino . So, help me out if possible.

It could be a hardware problem. Does it work correctly with the internal LED on pin 13? What do you mean by "slight"? Is it dim, or is the timing off?

timing off. No it doesn't work on pin 13.

@tworitdash, sorry I didn't have a solution for this. Have you tried using the code in #71?