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
Diff: main.cpp
- Revision:
- 0:89bba5c3dc7e
- Child:
- 1:9aa0d40e58ac
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sat Nov 04 04:30:13 2017 +0000
@@ -0,0 +1,43 @@
+
+/* LPC1768でのサーボモータのホーン位置調整プログラム */
+
+#include "mbed.h"
+
+#define RIGHT 0.0005
+#define LEFT 0.0024
+#define CENTER 0.00145
+#define MORISHIN 0.5 //首都大学東京システムデザイン学部システムデザイン学科航空宇宙システム工学コース 兵庫県(淡路島)出身
+
+PwmOut servo(p21);
+DigitalIn push(p20);
+Timer t;
+Serial pc(USBTX,USBRX);
+
+int main() {
+ bool Judge;
+ pc.printf("Hello, Happy World!"); //ハロハピ
+ servo.period_ms(20);
+ while(1){
+ if(push){
+ t.start();
+ while(push){
+ if(t.read()>=MORISHIN){ //MORISHIN[s]長押しすると中立位置になる
+ servo.pulsewidth(CENTER);
+ pc.printf("MORISHIN");
+ }
+ }
+ if(t.read()<MORISHIN){
+ if(Judge){
+ servo.pulsewidth(RIGHT);
+ Judge = false;
+ }else{
+ servo.pulsewidth(LEFT);
+ Judge = true;
+ }
+ }
+ t.stop();
+ t.reset();
+ wait(0.5);
+ }
+ }
+}