12_han_meiji / Mbed 2 deprecated 5_3

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
komachiangel72
Date:
Wed Oct 30 02:48:03 2019 +0000
Commit message:
a

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Oct 30 02:48:03 2019 +0000
@@ -0,0 +1,39 @@
+#include "mbed.h"
+
+
+PwmOut AIN1(A1);
+PwmOut AIN2(A2);
+//DigitalOut out(D10);//D10ピンへの出力をコントロール
+//digitalOut→0or1(ONorOFF)をコントロール、
+//myledはDigitalOut型の変数LED1のポートを初期化するという意味
+
+//AnalogIn photo(A0);
+//AnalogIn schmitt(A5);
+
+//void motor_control(PwmOut 
+
+int main() {
+    float d=0.5;
+    
+    while(1) {//組み込み型のプログラムは無限ループになるようにする。(終わってはいけない)
+        
+        //正回転
+
+        AIN1 = 0;
+        AIN2 = 1;
+        AIN1.write(d);//デューティー比を指定(0~1)
+        AIN2.write(d);//デューティー比を指定(0~1)
+        wait(5.0); // 1 sec
+
+        //逆回転   
+        AIN1 = 1;
+        AIN2 = 1;
+        AIN1.write(d);//デューティー比を指定(0~1)
+        AIN2.write(d);//デューティー比を指定(0~1)
+        wait(5.0); // 1 sec
+        
+        if(d == 1.0)break;
+        d = d + 0.1;
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Oct 30 02:48:03 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file