<commit_before>#!/usr/bin/python
#<NAME>
#April 22, 2016

import sys
import time
import serial
ser = serial.Serial('/dev/ttyACM0', 9600)
#stings and ints for storing left and right motor power
mLint = 0
mRint = 0
mL = ''
mR = ''
#prepare for stop
Stp = '0,0!'
BAS=bytearray()
BAS.extend(map(ord, Stp))

def IsAnInt(recString):
    try:
        int(recString)
        return True
    except ValueError:
        return False

print('Type "stop" at any time to stop car')
print('To maintain levels, don\'t enter integer. Valid input: 0<int<255')

while mL != 'stop' and mR != 'stop':
    mL = input('Set left motor power: ')
    if (mL.lower() != 'stop'):
        mR = str(input('Set right motor power: '))
    if (mL.lower() == 'stop' or mR.lower() == 'stop'): #immediately stop
        ser.write(BAS)
        sys.exit('Stopped')
    #if user entered text (button mash), maintain motor levels
    if IsAnInt(mL):
        mLint = int(mL)
        if mLint > 255:
            mLint = 255
        if mLint < 0:
            mLint = 0
    if IsAnInt(mR):
        mRint = int(mR)
        if mRint > 255:
            mRint = 255
        if mRint < 0:
            mRint = 0

    print('\nCurrent Values - Left Motor: %d   Right Motor: %d' %(mLint, mRint))
    output = str(mLint) + ',' + str(mRint) + '!' #this is how arduino finds values
    BA = bytearray()
    BA.extend(map(ord, output))
    #print (BA)
    ser.write(BA)

<commit_msg>Can now send data in a format that the arduino can understand<commit_after>#!/usr/bin/python
#Created by <NAME> on 2016-06-25.
#Copyright (c) 2016 <NAME>. All rights reserved.

import sys
import time
import serial
ser = serial.Serial('/dev/ttyACM0', 9600)
contentIsMessage = False

#SET FROM SOCKET IO
recMessage = "this is purely a message"
recSequence = "2 4 1 2 4 3 6 4 3 5"



if (contentIsMessage):
    #Process message and send to Arduino
    oString = "m " + recMessage + "|"
    BA = bytearray()
    BA.extend(map(ord, oString))
    print(BA)
    ser.write(BA)
else:
    #Process sequence and send to Arduino
    oString = "s " + recSequence + "|"
    BA = bytearray()
    BA.extend(map(ord, oString))
    print(BA)
    ser.write(BA)
    



#stings and ints for storing left and right motor power
##mLint = 0
##mRint = 0
##mL = ''
##mR = ''

###prepare for stop
##Stp = '0,0!'
##BAS=bytearray()
##BAS.extend(map(ord, Stp))
##
##def IsAnInt(recString):
##    try:
##        int(recString)
##        return True
##    except ValueError:
##        return False
##
##print('Type "stop" at any time to stop car')
##print('To maintain levels, don\'t enter integer. Valid input: 0<int<255')
##
##while mL != 'stop' and mR != 'stop':
##    mL = input('Set left motor power: ')
##    if (mL.lower() != 'stop'):
##        mR = str(input('Set right motor power: '))
##    if (mL.lower() == 'stop' or mR.lower() == 'stop'): #immediately stop
##        ser.write(BAS)
##        sys.exit('Stopped')
##    #if user entered text (button mash), maintain motor levels
##    if IsAnInt(mL):
##        mLint = int(mL)
##        if mLint > 255:
##            mLint = 255
##        if mLint < 0:
##            mLint = 0
##    if IsAnInt(mR):
##        mRint = int(mR)
##        if mRint > 255:
##            mRint = 255
##        if mRint < 0:
##            mRint = 0
##
##    print('\nCurrent Values - Left Motor: %d   Right Motor: %d' %(mLint, mRint))
##    output = str(mLint) + ',' + str(mRint) + '!' #this is how arduino finds values
##    BA = bytearray()
##    BA.extend(map(ord, output))
##    #print (BA)
##    ser.write(BA)


{'fraction_non_alphanumeric': 0.15774647887323945, 'fraction_numerical': 0.024225352112676058, 'mean_word_length': 2.5616850551654964, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1123709', 'n_tokens_mistral': 1372, 'n_tokens_neox': 1245, 'n_words': 389}