Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Vicente Castellano Gómez
/
robotAmbientales
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
778d5818
authored
Apr 29, 2024
by
Vicente Castellano Gómez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Añadido giro
parent
a434fd4e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
robot.py
robot.py
0 → 100644
View file @
778d5818
class
Robot
:
def
__init__
(
self
,
robot
,
ev3
,
giroSensor
,
colorSensor
):
self
.
robot
=
robot
self
.
ev3
=
ev3
self
.
giroSensor
=
giroSensor
self
.
colorSensor
=
colorSensor
#Metodo para el giro
def
giro
(
grados
):
robot
.
reset
()
giroSensor
.
reset_angle
(
0
)
robot
.
turn
(
grados
)
while
(
giroSensor
.
angle
()
!=
grados
):
diferencia
=
giroSensor
.
angle
()
-
grados
ajuste
=
diferencia
*
-
1
for
i
in
range
(
abs
(
ajuste
)):
if
(
ajuste
>
0
):
robot
.
turn
(
1
)
else
:
if
(
ajuste
<
0
):
robot
.
turn
(
-
1
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment