top of page
Search
Writer's pictureBen

My first time using Python

BEN:

This is my first time using Python and it seemed very confusing at first, but once my team had walked me through the basic commands I became more and more familiar with it and understood what I was doing.


I now know the basic commands such as: print, input, if, elif, else & while.


Using these commands I was able to write a basic driving program:


#drive both motors forward

def go():

print("drive(motorA, 100, 20)")

print("drive(motorB, 100, 20)")#drive both motors back


#drive both motors backward

def back():

print("drive(motorA, -100, 10)")

print("drive(motorB, -100, 10)")#drive left motor forward


#drive right motor backwards

def Right():

print("drive(motorB, 100, 5)")

print("drive(motorA, -100, 5)")#drive right motor forwards


#drive left motor backwards

def Left():

print("drive(motorB, 100, 5)")

print("drive(motorA, -100, 5)")#drive left motor forwards


def BigLeft():

print ("drive(motorA, -100, 10)")#drive right motor forwards


def BigRight():

print("drive(motorB, -100, 10)")


command = "hey"

while command != "stop":

command = input("What is your command?")

if command == "big left":

BigLeft()

elif command == "big right":

BigRight()

elif command == "go":

go()

elif command == "back":

back()

elif command == "right":

Right()

elif command == "left":

Left()

elif command == "stop":

print("")

else:

print ("That 'Aint No Command!")




5 views0 comments

Recent Posts

See All

Comments


bottom of page