An open API service indexing awesome lists of open source software.

https://github.com/skythecodemaster/vex-python

Various pieces of code that I use in my Vex Robotics projects
https://github.com/skythecodemaster/vex-python

Last synced: about 2 months ago
JSON representation

Various pieces of code that I use in my Vex Robotics projects

Awesome Lists containing this project

README

        

# vex-python
Various pieces of code that I use in my Vex Robotics projects

# Docs
## [Event Handler](https://github.com/SkyTheCodeMaster/vex-python/blob/master/events.py)

The event handler abstracts adding functions as callbacks into a simple decorator interface.
In order to use it, you must copy the `EventHandler` class into your code.
Examples:
```py
MyEvents = EventHandler(controller_1)

@MyEvents.on("controllerAxis1")
def PrintAxis(pos):
print(pos)
```

Event Reference

| Event Name | Argument 1 | Argument 2 |
|---------------------------------|------------|------------|
| `controllerAxis1` | `pos` | |
| `controllerAxis2` | `pos` | |
| `controllerAxis3` | `pos` | |
| `controllerAxis4` | `pos` | |
| | | |
| `controllerButtonAPressed` | | |
| `controllerButtonBPressed` | | |
| `controllerButtonXPressed` | | |
| `controllerButtonYPressed` | | |
| `controllerButtonUpPressed` | | |
| `controllerButtonDownPressed` | | |
| `controllerButtonLeftPressed` | | |
| `controllerButtonRightPressed` | | |
| `controllerButtonL1Pressed` | | |
| `controllerButtonL2Pressed` | | |
| `controllerButtonR1Pressed` | | |
| `controllerButtonR2Pressed` | | |
| | | |
| `controllerButtonAReleased` | | |
| `controllerButtonBReleased` | | |
| `controllerButtonXReleased` | | |
| `controllerButtonYReleased` | | |
| `controllerButtonUpReleased` | | |
| `controllerButtonDownReleased` | | |
| `controllerButtonLeftReleased` | | |
| `controllerButtonRightReleased` | | |
| `controllerButtonL1Released` | | |
| `controllerButtonL2Released` | | |
| `controllerButtonR1Released` | | |
| `controllerButtonR2Released` | | |
| | | |
| `screenPressed` | `x` | `y` |
| `screenReleased` | `x` | `y` |

## [Loop Decorator](https://github.com/SkyTheCodeMaster/vex-python/blob/master/loop.py)

This decorator simply loops a function every X milliseconds.
Usage:
```py
@loop(50) # Argument is in milliseconds
def myLoopedFunction():
print("loop")
```
The function starts running immediately when called with the decorator, you do not need to do `myLoopedFunction()` later on in your code.