Skip to content

Instantly share code, notes, and snippets.

@thekitchenscientist
Created August 20, 2015 19:36
Show Gist options
  • Save thekitchenscientist/cb391d7486eae64cf436 to your computer and use it in GitHub Desktop.
Save thekitchenscientist/cb391d7486eae64cf436 to your computer and use it in GitHub Desktop.
A simple test of direct commands using ev3py (https://github.com/thiagomarzagao/ev3py).
#import modules
import time
from ev3py import ev3
#create a reference to the ev3 called 'mybrick'
mybrick = ev3()
# connect with EV3 via Bluetooth
mybrick.connect('bt')
#send a series of 3 tones
mybrick.play_tone(100,300,800)
time.sleep(0.5)
mybrick.play_tone(100,500,800)
time.sleep(0.5)
mybrick.play_tone(100,700,800)
#drive tracker in a circle spinning the blade for 10 seconds
mybrick.motor_start('ab',power=20)
mybrick.motor_start('c',power=-20)
time.sleep(10)
#stop
mybrick.motor_stop('abc',stop='coast')
mybrick.disconnect()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment