INCTRC Information Sharing Test
/
servo
とりあえずサーボ
main.cpp@0:ab96da3f6b93, 2018-09-04 (annotated)
- Committer:
- yuron
- Date:
- Tue Sep 04 04:41:01 2018 +0000
- Revision:
- 0:ab96da3f6b93
????????
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yuron | 0:ab96da3f6b93 | 1 | // Continuously sweep the servo through it's full range |
yuron | 0:ab96da3f6b93 | 2 | //このプログラムは記憶にございません |
yuron | 0:ab96da3f6b93 | 3 | //とりあえずサーボ回せるはず... |
yuron | 0:ab96da3f6b93 | 4 | //製作者: 4D 高久雄飛, mail: rab1sy23@gmail.com |
yuron | 0:ab96da3f6b93 | 5 | #include "mbed.h" |
yuron | 0:ab96da3f6b93 | 6 | #include "Servo.h" |
yuron | 0:ab96da3f6b93 | 7 | |
yuron | 0:ab96da3f6b93 | 8 | Servo myservo(p21); |
yuron | 0:ab96da3f6b93 | 9 | |
yuron | 0:ab96da3f6b93 | 10 | int main() { |
yuron | 0:ab96da3f6b93 | 11 | while(1) { |
yuron | 0:ab96da3f6b93 | 12 | for(int i=0; i<100; i++) { |
yuron | 0:ab96da3f6b93 | 13 | myservo = i/100.0; |
yuron | 0:ab96da3f6b93 | 14 | //wait(0.01); |
yuron | 0:ab96da3f6b93 | 15 | wait(0.01); |
yuron | 0:ab96da3f6b93 | 16 | } |
yuron | 0:ab96da3f6b93 | 17 | for(int i=100; i>0; i--) { |
yuron | 0:ab96da3f6b93 | 18 | myservo = i/100.0; |
yuron | 0:ab96da3f6b93 | 19 | //wait(0.01); |
yuron | 0:ab96da3f6b93 | 20 | wait(0.01); |
yuron | 0:ab96da3f6b93 | 21 | } |
yuron | 0:ab96da3f6b93 | 22 | } |
yuron | 0:ab96da3f6b93 | 23 | } |