Mechatro5 / Mbed 2 deprecated Programs

Dependencies:   mbed Motor

Files at this revision

API Documentation at this revision

Comitter:
yasunorihirakawa
Date:
Thu Oct 31 05:24:48 2019 +0000
Commit message:
motor.h; motor.cpp; main.cpp

Changed in this revision

Motor.lib Show annotated file Show diff for this revision Revisions of this file
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/Motor.lib	Thu Oct 31 05:24:48 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/Mechatro5/code/Motor/#6ad0e900f423
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Oct 31 05:24:48 2019 +0000
@@ -0,0 +1,35 @@
+#include "mbed.h"
+#include "motor.h"
+
+Motor motor1(D5, D4);
+DigitalOut motor_mode(D13);
+InterruptIn iin(D12);
+Ticker timer1;
+Ticker timer2;
+
+void PGsensor()
+{
+    motor1.count();
+}
+
+void rpm_of_motor()
+{
+    motor1.calc_rpm();
+}
+
+void control_motor()
+{
+    motor1.drive();
+}
+
+int main()
+{
+    motor1.Set_target(3000);
+    motor1.Set_phase(1);
+    
+    iin.rise(&PGsensor);
+    iin.fall(&PGsensor);
+
+    timer1.attach(&rpm_of_motor, motor1.MEASUREMENT_INTERVAL);
+    timer2.attach(&control_motor, motor1.MEASUREMENT_INTERVAL);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Oct 31 05:24:48 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file