Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed SoftPWM Servo_softpwm IR2302
Revision 3:559589cd51de, committed 2021-10-30
- Comitter:
- umekou
- Date:
- Sat Oct 30 00:19:02 2021 +0000
- Parent:
- 2:b8e36dfae8e0
- Commit message:
- defined default servo angle
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Oct 29 11:53:54 2021 +0000
+++ b/main.cpp Sat Oct 30 00:19:02 2021 +0000
@@ -1,6 +1,8 @@
#include "mbed.h"
#include "Servo.h"
#include "IR2302.h"
+
+#define DSA 0.8//default servo angle:サーボの初期角度の値
DigitalOut stop(D13);
IR2302 ir2302(D7,D8);
@@ -13,9 +15,8 @@
int main()
{
stop=1;
- float servoValue[3]={0.9,0.9,0.9};
- float time;
- float angle=0.9;
+ float servoValue[3]={DSA,DSA,DSA};
+ float angle=DSA;
int i,j;
for(int i=0;i < 3; i++)servo[i].calibrate(0.00095, 90);
for(i=0;i<3;i++) servo[i].write(servoValue[i]);
@@ -54,15 +55,4 @@
}
for(i=0;i<3;i++) servo[i].write(servoValue[i]);
}
- /*
- while(1){
- time=t.read();
- for(i=0;i<3;i++){
- servoValue[i]=sin(time);
- }
- for(i=0;i<3;i++){
- servo[i].pulsewidth_us((int)(950.0 * servoValue[i] + 1450));
- }
- }
- */
-}
+}
\ No newline at end of file