austinbv/dino

Leonardo board error

Closed this issue · 5 comments

dino_serial:12: error: conversion from 'Serial_' to non-scalar type 'HardwareSerial' requested

I just got in my leonardo boards and wanted to see if dino worked well on them. I was able to change serial to Serial1 and get that error to go away, but I still get an error when trying to connect to the board.

HardwareSerial serial = Serial1;
irb
2.0.0-p195 :001 > require 'dino'
 => true 
2.0.0-p195 :002 > board = Dino::Board.new(Dino::TxRx::Serial.new)
Dino::BoardNotFound: Dino::BoardNotFound
    from ~/.rvm/gems/ruby-2.0.0-p195/gems/dino-0.12.0/lib/dino/tx_rx/base.rb:46:in `handshake'
    from ~/.rvm/gems/ruby-2.0.0-p195/gems/dino-0.12.0/lib/dino/board.rb:11:in `initialize'
    from (irb):2:in `new'
    from (irb):2
    from ~/.rvm/rubies/ruby-2.0.0-p195/bin/irb:16:in `<main>'

Looks like the #ifdef statement for detecting different serial interfaces needs to be refined. In the meantime can you change Serial on https://github.com/austinbv/dino/blob/0.12.0-wip/src/dino_serial.ino#L20 to serial and see if that works?

It didn't do anything new. Should I compile it with debug and open the
monitor and do anything? It oddly looks to be connected, I have to kill
irb to be able to communicate with the IDE after trying to connect.

It should work once serial ends up pointing to Serial1 for the Leonardo. You can open the monitor in the Arduino IDE and just type 99. If it responds, no reason it shouldn't work with ruby.

On Tuesday, October 15, 2013 at 9:17 PM, Justin Edwards wrote:

It didn't do anything new. Should I compile it with debug and open the
monitor and do anything? It oddly looks to be connected, I have to kill
irb to be able to communicate with the IDE after trying to connect.


Reply to this email directly or view it on GitHub (#65 (comment)).

It blinks like it acknowledges something, but there isn't any output. I
actually checked around online a bit and looks like I need to upgrade my
IDE (1.5.2) there were some fixes in 1.5.4. I'm going to try a few
things. I couldn't get any output from even basic serial examples.

Command - 99
Pin - 
Value - 
Responded with - 

I was able to get it working by removing the checks at the beginning including hardwarserial and then changing all lowercase serial to Serial

#include "Dino.h"
#include <Servo.h>
#include <LiquidCrystal.h>
#include <SoftwareSerial.h>
#include "DHT.h"
Dino dino;

// Use the native Serial port on the Arduino Due


// Dino.h doesn't handle TXRX. Setup a function to tell it to write to Serial.
void writeResponse(char *response) { Serial.print(response); }
void (*writeCallback)(char *str) = writeResponse;

void setup() {
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
  dino.setupWrite(writeCallback);
}

void loop() {
  while(Serial.available() > 0) dino.parse(Serial.read());
  dino.updateListeners();
  Serial.flush();
}