<commit_before>#! /usr/bin/python

# Test script to show how to send position commands to servos attached to a CM-5 or CM-700

import serial
import optparse
import time
import sys

DEFAULT_MOTOR_SPEED = 100

#---------------------------------------------------------------------------------------------------
DEFAULT_SERIAL_PORT = "/dev/ttyUSB0"
DEFAULT_BAUD_RATE = 57600

parser = optparse.OptionParser( usage="usage: %prog [options]" )
parser.add_option( "-p", "--port", dest="port", default=DEFAULT_SERIAL_PORT,
                  help="The serial port to try to connect on" )
parser.add_option("-b", "--baud", dest="baudRate", default=DEFAULT_BAUD_RATE,
                  help="Baud rate to use for communication" )

(options, args) = parser.parse_args()

# Open serial port to communicate with the control board
serialChannel = serial.Serial( options.port, int( options.baudRate ) )

# Stop any existing animation
serialChannel.write( "StopAnim\n" )
time.sleep( 0.5 )

# Set up a dummy animation which will allow us to send position commands without delay
serialChannel.write( "SetAnimFrame 0\n" )
serialChannel.write( "ClearAnimFrame\n" )
serialChannel.write( "SetNextAnimFrame 0\n" )
serialChannel.write( "SetAnimWaitTimeMS 0\n" )<commit_msg>Modified hardware movement demo so that it would run on Windows as well as Linux<commit_after>#! /usr/bin/python

# Test script to show how to send position commands to servos attached to a CM-5 or CM-700

import serial
import optparse
import time
import sys

DEFAULT_MOTOR_SPEED = 100

#---------------------------------------------------------------------------------------------------
if sys.platform == "win32":
	DEFAULT_SERIAL_PORT = "COM3"
else:
	DEFAULT_SERIAL_PORT = "/dev/ttyUSB0"
DEFAULT_BAUD_RATE = 57600

parser = optparse.OptionParser( usage="usage: %prog [options]" )
parser.add_option( "-p", "--port", dest="port", default=DEFAULT_SERIAL_PORT,
                  help="The serial port to try to connect on" )
parser.add_option("-b", "--baud", dest="baudRate", default=DEFAULT_BAUD_RATE,
                  help="Baud rate to use for communication" )

(options, args) = parser.parse_args()

# Open serial port to communicate with the control board
serialChannel = serial.Serial( options.port, int( options.baudRate ) )

# Stop any existing animation
serialChannel.write( "StopAnim\n" )
time.sleep( 0.5 )

# Set up a dummy animation which will allow us to send position commands without delay
serialChannel.write( "SetAnimFrame 0\n" )
serialChannel.write( "ClearAnimFrame\n" )
serialChannel.write( "SetNextAnimFrame 0\n" )
serialChannel.write( "SetAnimWaitTimeMS 0\n" )
{'fraction_non_alphanumeric': 0.17427701674277016, 'fraction_numerical': 0.014840182648401826, 'mean_word_length': 3.0822981366459627, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '363200', 'n_tokens_mistral': 783, 'n_tokens_neox': 749, 'n_words': 244}