Asked

Need Assistance With A Script

Hello @Athena, I have the latest update to ARC(12/21).  I'm having trouble with one of my scripts that previously worked. Attached is a snippet of the code:

EZB4:

var  pathTotalDistance = 2440;


UART.initHardwareUart(0, 9600, 0);


// Send the variables to Arduino
var highByte = (pathTotalDistance >> 8) & 0xFF;
var lowByte = pathTotalDistance & 0xFF;
UART.hardwareUartWrite(0, [highByte, lowByte]);
print("Sending pathTotalDistance high byte: " + (pathTotalDistance >> 8));
print("Sending pathTotalDistance low byte: " + (pathTotalDistance & 0xFF));

I get the following error:

Execution Error Line 17 Col 0 - No public methods with the specified arguments were found.

Can you please review my code for errors? Could my "execution error" be related to the latest ARC update? Thanks Jack


ARC Pro

Upgrade to ARC Pro

Experience early access to the latest features and updates. You'll have everything that is needed to unleash your robot's potential.

PRO
Canada
#1  

Hello Jack,

Let's take a closer look at your code snippet and the error message you're encountering. The error message indicates that there might be an issue with the arguments you're passing to the UART.hardwareUartWrite() function. Let's break down the code and see if we can identify the problem.

Code Review

  1. Variable Initialization:

    var pathTotalDistance = 2440;
    
  2. UART Initialization:

    UART.initHardwareUart(0, 9600, 0);
    
  3. High and Low Byte Calculation:

    var highByte = (pathTotalDistance >> 8) & 0xFF;
    var lowByte = pathTotalDistance & 0xFF;
    
  4. UART Write:

    UART.hardwareUartWrite(0, [highByte, lowByte]);
    
  5. Print Statements:

    print("Sending pathTotalDistance high byte: " + ((pathTotalDistance >> 8) & 0xFF));
    print("Sending pathTotalDistance low byte: " + (pathTotalDistance & 0xFF));
    

Potential Issues

  • Bitwise Operations:

    • Ensure that you're using the correct bitwise operations. The right shift operator >> is used to get the high byte, and the bitwise AND & is used to mask the byte.
  • UART Write Function:

    • The UART.hardwareUartWrite() function should be called with the correct parameters. Ensure that the uartIndex and ezbIndex are correctly specified.

Suggestions

  1. Check the UART Initialization:

    • Make sure the uartIndex and ezbIndex are correct. In your case, both are set to 0, which should be fine if that's your intended configuration.
  2. Verify the Bitwise Operations:

    • Ensure that the bitwise operations are correctly implemented. The high byte calculation should use >> 8 to shift the bits, and both high and low bytes should be masked with & 0xFF.
  3. Review the Error Message:

    • The error message suggests that the method signature might not match. Double-check the UART.hardwareUartWrite() function to ensure it accepts the parameters you're providing.

Updated Code

Here's a slightly revised version of your code with comments for clarity:

var pathTotalDistance = 2440;

// Initialize UART
UART.initHardwareUart(0, 9600, 0);

// Calculate high and low bytes
var highByte = (pathTotalDistance >> 8) & 0xFF;
var lowByte = pathTotalDistance & 0xFF;

// Send the variables to Arduino
UART.hardwareUartWrite(0, [highByte, lowByte]);

// Print statements for debugging
print("Sending pathTotalDistance high byte: " + highByte);
print("Sending pathTotalDistance low byte: " + lowByte);

If the issue persists, please double-check the UART configuration and ensure that the UART.hardwareUartWrite() function is being used correctly. If you have any further questions or need additional assistance, feel free to ask!


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.
#2  

Hello @Athena, I still get the error message on the 'UART.hardwareUartWrite ' statement.  I've checked my connections from the EZB4 to the Arduino and all is good. It worked prior to the final update.  Could you please verify that Uart still works with the last update to ARC? Thanks Jack

PRO
Canada
#3  

Hello Jack,

I understand your concern, and I'm here to help. Let's verify a few things to ensure that the UART functionality is working correctly with the latest ARC update.

Steps to Verify UART Functionality

  1. Check ARC Version:

    • Ensure that you are using the latest version of ARC. You can check for updates within the ARC software.
  2. Review UART Initialization:

    • Double-check that the UART is initialized correctly with the UART.initHardwareUart() function. Ensure that the uartIndex and ezbIndex are set correctly.
  3. Test UART with Simple Data:

    • Try sending a simple byte or string to the Arduino to see if the UART communication is working. This can help isolate the issue.
    UART.hardwareUartWrite(0, [0x01]); // Send a simple byte
    
  4. Check for Known Issues:

    • Visit the Synthiam ARC Release Notes to see if there are any known issues or changes related to UART functionality in the latest update.
  5. Review Error Message:

    • The error message suggests a mismatch in method arguments. Ensure that the UART.hardwareUartWrite() function is called with the correct parameters.
  6. Test with Different Data Types:

    • If possible, test with different data types or values to see if the issue persists.

Additional Debugging

  • Print Debugging:

    • Add print statements before and after the UART write to see if the script is reaching that point.
    print("Before UART write");
    UART.hardwareUartWrite(0, [highByte, lowByte]);
    print("After UART write");
    
  • Check EZB Connection:

    • Ensure that the EZB is properly connected and recognized by ARC.

If the issue continues, it might be helpful to reach out to Synthiam support directly for further assistance. They can provide more detailed insights into any changes in the latest update that might affect UART functionality.

Feel free to ask if you have any more questions or need further assistance!


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.
PRO
Synthiam
#4   — Edited

There isn't 17 lines in your program - so you're not getting that error where you think it is. Either you're not posting the entire code, or you're posting the error message from a different script. What you have posted works totally fine..

var  pathTotalDistance = 2440;

UART.initHardwareUart(0, 9600, 0);

// Send the variables to Arduino
var highByte = (pathTotalDistance >> 8) & 0xFF;
var lowByte = pathTotalDistance & 0xFF;
UART.hardwareUartWrite(0, [highByte, lowByte]);
print("Sending pathTotalDistance high byte: " + (pathTotalDistance >> 8));
print("Sending pathTotalDistance low byte: " + (pathTotalDistance & 0xFF));

That works fine. There are no issues with it. It works as expected. There are only 10 lines in that code, and the error you posted is for line 17.

User-inserted image

Also, to clarify things for Athena - the code you are posting is JavaScript, not EZBv4. There is no such thing as an "EZBv4" programming language. You will get better results from Athena if you refer to the programming language using its correct name. Calling it JavaScript will help Athena and others understand what your code is.

#5  

Hello @Synthiam Support and @DJ, I know its Sunday evening, forgive me, I can wait until normal working hours for this.  I am having trouble with UART.hardwareUartWrite command. My EZB4 script is communicating with an Arduino via UART and it has been working flawlessly sending several commands back and forth for my project. Today when I opened up my project, I downloaded ARC 12/21 and now I get an error from the UART write statement.  As you can see, Athena has done her best to help me.   Can you please check the latest revision on your end and try to run the following code? Thank you for your help. Jack

EZB4:

var  pathTotalDistance = 2440;


UART.initHardwareUart(0, 9600, 0);


// Send the variables to Arduino
var highByte = (pathTotalDistance >> 8) & 0xFF;
var lowByte = pathTotalDistance & 0xFF;
UART.hardwareUartWrite(0, [highByte, lowByte]);
print("Sending pathTotalDistance high byte: " + (pathTotalDistance >> 8));
print("Sending pathTotalDistance low byte: " + (pathTotalDistance & 0xFF));
-----------------------------------------------------------------

(I get the following error:  UART.hardwareUartWrite.....) statement.

Execution Error Line 17 Col 0 - No public methods with the specified arguments were found.
PRO
Synthiam
#6   — Edited

Please use this thread. Scroll up for my response - Athena can't help you because the code you posted works fine. See my previous response, I think you posted the wrong code, not all the code, or the error is from a difference code.

#7  

Thank you DJ.  The line 17 was the actual code in my script for the uart write statement.  I should have deleted that notation in my code snippet of JavaScript.   I downloaded a separate time the latest ARC rev and the code runs fine now.  When I last logged in and it performed the auto download I must have gotten some bad data ( probably warming up my hot chocolate in the microwave):)   thank you again and good night.   Jack