Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Praktika GruLaIT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Samuel Helbling
Praktika GruLaIT
Commits
3da20e50
Commit
3da20e50
authored
4 years ago
by
Samuel Helbling
Browse files
Options
Downloads
Patches
Plain Diff
Sourcecode für Servo_Sweep-Beispiel eingefügt
parent
80526251
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Uebung_2_Servo_Sweep/platformio.ini
+1
-0
1 addition, 0 deletions
Uebung_2_Servo_Sweep/platformio.ini
Uebung_2_Servo_Sweep/src/main.cpp
+25
-2
25 additions, 2 deletions
Uebung_2_Servo_Sweep/src/main.cpp
with
26 additions
and
2 deletions
Uebung_2_Servo_Sweep/platformio.ini
+
1
−
0
View file @
3da20e50
...
...
@@ -12,3 +12,4 @@
platform
=
atmelavr
board
=
uno
framework
=
arduino
lib_deps
=
arduino-libraries/Servo @ ^1.1.7
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Uebung_2_Servo_Sweep/src/main.cpp
+
25
−
2
View file @
3da20e50
/* Sweep
by BARRAGAN <http://barraganstudio.com>
This example code is in the public domain.
modified 8 Nov 2013
by Scott Fitzgerald
http://www.arduino.cc/en/Tutorial/Sweep
*/
#include
<Arduino.h>
#include
<Servo.h>
Servo
myservo
;
// create servo object to control a servo
// twelve servo objects can be created on most boards
int
pos
=
0
;
// variable to store the servo position
void
setup
()
{
// put your setup code here, to run once:
myservo
.
attach
(
9
);
// attaches the servo on pin 9 to the servo object
}
void
loop
()
{
// put your main code here, to run repeatedly:
for
(
pos
=
0
;
pos
<=
180
;
pos
+=
1
)
{
// goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo
.
write
(
pos
);
// tell servo to go to position in variable 'pos'
delay
(
15
);
// waits 15ms for the servo to reach the position
}
for
(
pos
=
180
;
pos
>=
0
;
pos
-=
1
)
{
// goes from 180 degrees to 0 degrees
myservo
.
write
(
pos
);
// tell servo to go to position in variable 'pos'
delay
(
15
);
// waits 15ms for the servo to reach the position
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment