afcorson
Can you convert the following Script code to Javascript?
controlCommand("Camera", "CameraFaceTrackingDisable") $FaceRecog = 0 $Speech = 0
Change eyes to blue
if (IsConnected(0) = 1) pwm(d17,100) pwm(d18,0) pwm(d19,0) pwm(d21,100) pwm(d22,0) pwm(d23,0) endif
Set all servos to start position
Servo(d0,90) Servo(d1,90) Servo(d2,40) Servo(d3,180) Servo(D4,25) Servo(D5,145) Servo(D6,90) Servo(D7,75) Servo(D8,140) # R Wrist Servo(D9,90) # L Wrist Servo(D10,90)
Pause for a tiny bit to ensure the servos have been initialized
sleep(100)
Set speed of these servos
ServoSpeed( D0, 5 ) ServoSpeed( D1, 5 ) ServoSpeed( D2, 5 ) ServoSpeed( D3, 5 ) ServoSpeed( D4, 5 ) ServoSpeed( D5, 5 ) ServoSpeed( D10, 5 )
if ($Topic = "") goto(section2) endif
Read random line from Topic File
$TopicFile = "c:\Images" $TopicFile = $TopicFile + GetCharAt($TopicFile,2) + GetCharAt($TopicFile,2) + $Topic + ".txt" $Text = FileReadLineRandom($TopicFile)
Speak specified text
#$Text = "Hello human. My name is pepper. I am here to help you."
:section2 ShowControl("Display Interface") sleep(200) sayWait($Topic) say($Text)
If no audio is played for over 2 seconds, then stop
$SilenceCnt = 0 repeatwhile($IsSpeaking) ServoRandom( D0, 40, 140 ) ServoRandom( D1, 75, 95 ) ServoRandom( D2, 40, 120 ) ServoRandom( D3, 100, 180 ) ServoRandom( D4, 30, 50 ) ServoRandom( D5, 130, 150 ) ServoRandom( D6, 100, 130 ) ServoRandom( D7, 45, 75 ) ServoRandom( D10, 80, 100 ) #Waist sleep(2000)
endrepeatwhile
#Change eyes back to green if (IsConnected(0)) PWM(D17,0) PWM(D18,0) PWM(D19,100) PWM(D21,0) PWM(D22,0) PWM(D23,100) endif $ScriptRunning = 0 $FaceRecog = 1 $Speech = 1 CloseControl("Display Interface") controlCommand("Speech Recognition", "PauseOff") controlCommand("Camera", "CameraFaceTrackingEnable") stop()
Related Hardware (view all EZB hardware)
Related Robot Skill (view all robot skills)

Certainly! Below is the converted JavaScript code for your ARC project. I've translated the EZ-Script commands to JavaScript, using the ARC JavaScript API.
Key Points:
controlCommand()to interact with other robot skills.Servo.setPosition(),Servo.setSpeed(), andPWM.set()for servo and PWM control.setVar()andgetVar()for global variable management.Feel free to ask if you have any 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.