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.
Revision 0:629c15c833cf, committed 2019-10-31
- Comitter:
- yasunorihirakawa
- Date:
- Thu Oct 31 05:24:48 2019 +0000
- Commit message:
- motor.h; motor.cpp; main.cpp
Changed in this revision
--- /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