Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var {loop, move, motor, read, sleep, out} = require('robot-loop')
- loop(main, 'ip address', {
- teamName: '',
- teamColor: '',
- game: ''
- })
- var steer = move()
- function main (input, rot) {
- if (input === 'f') {
- f(rot)
- } else if (input === 'b') {
- b(rot)
- } else if (input === 'l') {
- l(rot)
- } else if (input === 'r') {
- r(rot)
- }
- }
- function f (rot) {
- out('moving forward')
- steer.rotations(rot, 100, 0)
- out('done')
- }
- function b (rot) {
- out('moving back')
- steer.rotations(-rot, 100, 0)
- out('done')
- }
- function l (rot) {
- out('turning left')
- steer.rotations(1, 100, -rot)
- out('done')
- }
- function r (rot) {
- out('turning right')
- steer.rotations(1, 100, rot)
- out('done')
- }
- function s (rot) {
- out('spinning')
- steer.rotation(rot, 40, 50)
- out('done')
- }
- function dance (rot) {
- out('dancing')
- s(4)
- f(1)
- b(1)
- r(45)
- out('done')
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement