Avatar JD icon Avatar JD — 3D Avatar JD simulator with bidirectional servo sync, action sequencing, $SIM_ scripting, EZ-B emulator support and pose/movement visualization Try it →
Asked
Resolved Resolved by DJ Sures!
1 Participant
Running PyCharmt to connect to EZB and call a script?

Running Pycharmt To Connect To EZB And Call A Script?

How to write python on pyCharm to connect to EZM using socket and then run a command, voice, script etc.?

I do not get any errors, just nothing happens lol

import socket

Define ARC system's IP address and port

host = '192.168.1.22' # Replace with the ARC system's IP address port = 23 # Replace with the ARC system's port (usually 23)

try: # Create a socket connection arc_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) arc_socket.connect((host, port))

# Specify the path to the ARC script
arc_script_path = "C:\\Users\\your_username\\Documents\\ARC\\My Projects\\test.ezb"  # Replace with the correct path

# Send the ARC script execution command
arc_script = f"RunScript({arc_script_path})"
arc_socket.send(arc_script.encode())

# You may not receive a response immediately, but you can add a delay or loop to check for a response if needed

# Close the socket connection
arc_socket.close()

except socket.error as e: print(f"Socket error: ") except Exception as e: print(f"An error occurred: ")



Related Hardware (view all EZB hardware)
EZ-B V3 by EZ-Robot
EZ-B v3 works with Synthiam ARC via Bluetooth COM port to control servos, sensors, scripts and robot skills.
Bluetooth
Servos 24
Camera
Audio
UART ✕
I2C
ADC 8
Digital 24

ARC Pro

Upgrade to ARC Pro

Get access to the latest features and updates before they're released. You'll have everything that's needed to unleash your robot's potential!

Author Avatar
PRO
Synthiam
LinkedIn Thingiverse Twitter YouTube GitHub
#9   — Edited

Control command requires double quotes

you escape a double quote with a \ backslash

#10  

You are brilliant.... and I figured it out thank you... this is what i have thus far... if there is a cleaner way let me know. this will now move the head of the robot, speak in it's voice, get information from my PC, pick a random bible verse, speak it and then move the head back to it's original place

from ARCClient import ARCClient import time import bible

server_ip = '127.0.0.1' server_port = 6666

command = 'SayEZB("Good day Terry, here is your bible quote for today")\n'

command1 = 'ServoSpeed(d0, 1)\n' command2 = 'Servo(d0, 1)\n' command3 = 'controlCommand("BingChat", "Track_1")\n'

vline = bible.line verse = bible.get_bible(vline) quoted_output = f'""' quoted_output = quoted_output.replace('\n', ' ').replace('\r', '') print(quoted_output)

command4 = f'SayEZB()\n' command5 = 'Servo(d0, 180)\n'

arc_client = ARCClient(server_ip, server_port) arc_client.connect() response = arc_client.send_command(command1) response = arc_client.send_command(command2) response = arc_client.send_command(command3) time.sleep(3.5) response = arc_client.send_command(command4) time.sleep(3.5) response = arc_client.send_command(command5) print("Received response:", response) arc_client.close()