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
916c040a
authored
Apr 22, 2024
by
Vicente Castellano Gómez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Funcion de giro funciona
parent
3fe3741a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
main.py
main.py
View file @
916c040a
...
@@ -17,3 +17,19 @@ right_motor = Motor(Port.D)
...
@@ -17,3 +17,19 @@ right_motor = Motor(Port.D)
giroSensor
=
GyroSensor
(
Port
.
S1
)
giroSensor
=
GyroSensor
(
Port
.
S1
)
robot
=
DriveBase
(
left_motor
,
right_motor
,
wheel_diameter
=
55.5
,
axle_track
=
124
)
robot
=
DriveBase
(
left_motor
,
right_motor
,
wheel_diameter
=
55.5
,
axle_track
=
124
)
#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