Serial won't work

About Forums Forum Breakout Beta Issues Serial won't work

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1071
    Jan2000
    Participant

    Hi Jeff

    First of all: Thank you for all the great work with Breakout!! I have used it a lot – but simply can’t get the new Serial class to work. Are you absolutely sure this works? I have tried your examples with a couple of different serial sensors – as well as just the serialRead and serialWrite examples simultaneously. Tried with software serial as well as hardware serial. Nothing works, I can’t see anything in the example or console.

    I am on Windows10, Chrome browser and the java server.
    Best regards,
    Jan

    #1073

    Hi Jan,

    Did you upload the new BreakoutFirmata sketch to your Arduino?
    https://github.com/soundanalogous/Breakout/tree/master/firmware/BreakoutFirmata

    You’ll need either BreakoutFirmata.ino or StandardFirmataPlus.ino to get the Serial functionality. BreakoutFirmata.ino includes support for Stepper motors but is otherwise equivalent to StandardFirmataPlus.ino (not to be confused with StandardFirmata.ino which does not support Serial).

    best,

    -jeff

    #1074
    Jan2000
    Participant

    Hi Jeff

    Yes I uploadet your BreakoutFirmata from https://github.com/soundanalogous/Breakout/tree/master/firmware/BreakoutFirmata.

    Are you able to get it to work using the serialWrite and serialRead examples?

    Jan

    #1075

    The serialRead example work for me without issue at 9600 baud (didn’t check other baud rates yesterday). I’ll test serialWrite again tonight to be sure, but I’ve never had an issue with it in the past nor with any baud rates under 57600. Higher baud rates (> 57600) do not work with SoftwareSerial.

    Are you setting the correct baud rate for your device and wiring RX on the board to TX on the device and vice versa?

    Also, which Arduino board and particular serial device are you using?

    #1076
    Jan2000
    Participant

    Yes I use baud rate 9600. Right now I am testing with two Arduinos: One running BreakoutFirmata and the other running this sketch:

    const int ledPin = 13; // the pin that the LED is attached to
    int incomingByte; // a variable to read incoming serial data into

    void setup() {
    // initialize serial communication:
    Serial.begin(9600);
    // initialize the LED pin as an output:
    pinMode(ledPin, OUTPUT);
    }

    void loop() {
    // see if there’s incoming serial data:
    if (Serial.available() > 0) {
    // read the oldest byte in the serial buffer:
    incomingByte = Serial.read();
    // if it’s a capital H (ASCII 72), turn on the LED:
    if (incomingByte == ‘H’) {
    digitalWrite(ledPin, HIGH);
    Serial.write(“We turn ON”);
    }
    // if it’s an L (ASCII 76) turn off the LED:
    if (incomingByte == ‘L’) {
    digitalWrite(ledPin, LOW);
    Serial.write(“We turn OFF”);
    }
    }
    }

    I have connected the Arduinos like this: http://robotic-controls.com/sites/default/files/learn/Arduino-ArduinoSerial.png

    In your serialWrite-example, I use hardware serial like this:
    serial = new Serial({
    board: arduino,
    port: Serial.HW_SERIAL1,
    baud: 9600
    });

    When I only use the Arduino with the above sketch and just write to it in the Arduino IDE serial monitor, it works – I can toggle the LED. But when I connect the two Arduinos and write via the serialWrite-example, it still doesn’t work.

    #1077

    There are a couple of issues:

    1. The first is that Serial won’t work the way you have illustrated in your diagram. HW_SERIAL1 corresponds to pins TX1 and RX1 on an Arduino Board. This is the Serial1 class in Arduino and not all board have these pins. The regular Serial class (pins marked RX and TX – typically pins 0 and 1) on the board cannot currently be used with the Firmata Serial feature. You’ll need to use a board like an Arduino Leonardo, Mega, Due, Zero, 101 or other board that has RX1 and TX1 pins in order to use Hardware serial. With an Arduino Uno, you have to use SoftwareSerial.

    2. There was an error in the serialWrite example that was not sending ascii characters so if you would have tried to view the output using the Arduino IDE Monitor you would not see anything printed. This is now fixed: https://github.com/soundanalogous/Breakout/commit/8d7bd0ba5cb50210efb1ce3c4e7702bf04f34d03

    #1078
    Jan2000
    Participant

    Ahh thank you! – now it works 🙂

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.