Skip to content

the-dan-ya/spike_prime_python_translator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python translator

For Spike Prime

  • Library of word blocks & python functions
  • Use to easily turn word block programs to python

Why I made this translator

Spike Prime transitioned from version 2 to version 3 in the summer of 2023. The python in version 3 is a lot less intuitive than than how it is written in version 2, and there aren't many tutorials on how to write using Spike Prime's python in version 3. So, I created this translator to hopefully allow python to be more accessible to anyone using Spike Prime.

How to use

Word Block Python
run_for run_for(port.A, motor.CLOCKWISE, 1, unit.ROTATIONS)
go_to_position go_to_absolute_position(port.A, motor.SHORTEST_PATH, 0)
start_motor start_motor(port.A,motor.CLOCKWISE)
stop_motor stop_motor(port.A)
set_speed_to set_speed_to(port.A,75)
absolute_position absolute_position(port.A)
motor_speed motor_speed(port.A)
move_for move_for(direction.FORWARD, 10, unit.ROTATIONS)
steer_for move_for(30, 10, unit.ROTATIONS)
start_moving start_moving(direction.FORWARD)
start_steering start_moving(30)
stop_moving stop_moving()
set_movement_speed_to set_movement_speed_to(50)
set_movement_motors_to set_movement_motors_to(port.A, port.B)
set_1_motor_rotation_to_cm set_1_motor_rotation_to_cm(17.5)
play_beep_for_seconds play_beep_for_seconds(60, 0.2)
wait_seconds wait_seconds(1)
wait_until wait_until(lambda: expression)
is_color is_color(port.A, color.RED)
get_color get_color(port.A)
More things I have yet to document.

SAMPLE

In the Competition Ready File there is:

  • A translation of every lesson
  • Translation of the guided mission and a simplified version of it
  • If you use a split screen to compare the python guided mission and the lessons in Spike Prime you will see how the translator works

About

For Spike Prime

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages