Skip to content

Instantly share code, notes, and snippets.

@scottnuma
scottnuma / vector.py
Last active February 18, 2016 18:22 — forked from mcleonard/vector.py
A vector class in pure python.
"""
The MIT License (MIT)
Copyright (c) 2015 Mat Leonard
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is

#How to use Python:

This assumes that you've already installed Python (which most of you have). If you haven't, download the python 2.7 installer from here

  1. Open up "IDLE (Python GUI)". You'll probably be able to find it by searching with the Windows Button

  2. Create a new file with File > New File.

  3. In the window that popped up (not the previous window with ">>>"), type

     print("Hello world!")  
    
@scottnuma
scottnuma / KewlLinks.md
Last active August 25, 2016 05:28
Kewl Links for Incoming UC Berkeley Freshmen
@scottnuma
scottnuma / move.py
Created February 6, 2018 19:26
Minimum code for a driving base kit
# Update motor values below
left_motor = "47245533815105973122875"
right_motor = "47254280750988421370725"
def autonomous_setup():
print("Autonomous mode has started!")
def autonomous_main():
pass
@scottnuma
scottnuma / hardware-test.py
Created March 9, 2018 19:07
Code to test robot hardware.
"""Code to just run the motors.
This code requires no gamepad and will only attempt to make the
motors spin. Useful for debugging hardware issues on robots.
"""
# Update motor values below
left_motor = ""
right_motor = ""
left = '47242536251659126000890'
right = '47257303962492263297599'
down = '47254280750988421370725'
up = '47257525192632122028127'
def autonomous_setup():
Robot.run(test_limits)
def drive_up():
Robot.set_value(up, "duty_cycle", 0.5)