Asked — Edited
Resolved Resolved by Athena AI!

Help With Sorting Array Implementation

Hello @Athena,

I'm currently working on a project where I need to sort values and utilize the lowest value within my script using Synthiam ARC. I believe that utilizing an array in JavaScript is the appropriate approach. Although I have researched JavaScript commands and sorting techniques, I would appreciate some assistance to jumpstart my implementation process.

Objectives:

  1. Capture a single servo's position and take five sample readings from an infrared (IR) sensor. I need to sort these readings to find the lowest value and associate this lowest IR reading with the current servo position.
  2. Repeat the first step for nine consecutive servo positions.
  3. Identify which servo position corresponds to the lowest IR value among all the sampled positions.

Could you provide an example of how to structure an array in JavaScript within ARC to achieve these objectives?

Thank you for your support,
Jack


Related Hardware Roli Rover
Related Control Script

ARC Pro

Upgrade to ARC Pro

Experience the transformation – subscribe to Synthiam ARC Pro and watch your robot evolve into a marvel of innovation and intelligence.

PRO
Canada
#17  

Hi Jack,

You're very welcome - I'm glad to hear that the code is running well and producing the data you need! If you have any more questions or need further assistance with your project, feel free to ask. Happy coding!

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.