Asked
Resolved Resolved by Athena AI!

Wheel Encoder Skill

Hi Athena,

I am experiencing difficulty loading the necessary library onto my Arduino Uno to ensure compatibility with the Wheel Encoder Counter Skill in Synthiam ARC. I have successfully loaded the "Servo.h" library, but I am unable to find the "SendOnlySoftwareSerial.h" library. Could you please guide me on where to locate the "SendOnlySoftwareSerial.h" library? This appears to be the issue preventing me from utilizing the Wheel Encoder Counter Skill effectively.

Thank you,
Jack


Related Hardware Roli Rover
Related Control Wheel Encoder Counter

ARC Pro

Upgrade to ARC Pro

Unleash your robot's full potential with the cutting-edge features and intuitive programming offered by Synthiam ARC Pro.

#33  

Hi @Athena I am thrilled to report the UART between my EZB4 and my Arduino is working!!  Many, many thanks to you and DJ for the tremendous assistance that you have provided me.  I had a bad pin on my UNO that prevented UART.  I replaced it with a MEGA 2560 and I'm good to go!

I have one question about the JavaScript code?

// Initialize UART on port 0 with a baud rate of 9600
UART.initHardwareUart(0, 9600);

function loop() {
    // Define the string to send
    var stringToSend = "a";

    // Send a request for data to the Arduino
    UART.hardwareUartWriteString(0, stringToSend);
    print("Sent: " + stringToSend + " to Arduino");

    // Wait a bit for the data to be transmitted
    sleep(50);

    // Check if data is available
    var dataAvail = UART.hardwareUartAvailable(0);
    print("Data available: " + dataAvail);

    if (dataAvail != 2) {
        print("The Arduino didn't send us anything. Exiting");
        return; // Exit the loop
    } else {
        // Read 2 bytes of data from the UART
        var encoders = UART.hardwareUartRead(0, 2);

        // Print the encoder values
        print("Encoder A: " + encoders[0]);
        print("Encoder B: " + encoders[1]);
    }

    // Wait before the next loop iteration
    sleep(100);

    // Call the loop function again
    loop();
}

// Start the loop
loop();

What does the ( 2  ) refer to in the below script?

 if (dataAvail != 2) {
        print("The Arduino didn't send us anything. Exiting");
        return; // Exit the loop

Again thank you for your help. Jack

PRO
Canada
#34  

Hi Jack!I'm thrilled to hear that your UART communication is working between the EZB4 and your Arduino MEGA 2560!That's fantastic news.

Regarding your question about the JavaScript code:

if (dataAvail != 2) {
    print("The Arduino didn't send us anything. Exiting");
    return; // Exit the loop
}

The 2 in this line of code refers to the expected number of bytes that the script anticipates receiving from the Arduino. In this context, it seems like the script is expecting to receive exactly 2 bytes of data from the Arduino, which correspond to the encoder values for "Encoder A" and "Encoder B". If the number of available bytes (dataAvail) is not equal to 2, the script assumes that the Arduino did not send the expected data and exits the loop.

If you have any more questions or need further clarification, feel free to ask. I'm here to help!


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
#35  

Hi @Athena,

What does the ( 2 ) refer to in the below script?

if (dataAvail != 2) { print("The Arduino didn't send us anything. Exiting"); return; // Exit the loop

Again, thank you for your help. Jack

#36  

Hi @Athena, Thanks for all your help.  My goal was accomplished.

Jack

PRO
Canada
#37  

Hi Jack,

You're very welcome! I'm delighted to hear that you accomplished your goal. If you have any more questions or need further assistance in the future, don't hesitate to reach out. Happy robotics building, and enjoy your Roli Rover!

Best regards, Athena


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.