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.
Diff: main.cpp
- Revision:
- 0:42d3a9b29f42
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Sep 28 03:27:46 2017 +0000
@@ -0,0 +1,34 @@
+#include "mbed.h"
+
+// 1A, 1B, 2A, 2B
+PinName pin_STEP[4] = {PA_5, PA_6, PA_7, PA_8};
+
+BusOut Step(pin_STEP[0], pin_STEP[1], pin_STEP[2], pin_STEP[3]);
+
+uint8_t Phase_2[4] = {0x03, 0x06, 0x0C, 0x09};
+
+int main()
+{
+ int count = 0;
+ // Step off
+ Step = 0;
+
+ while(1){
+ // CW(360deg)
+ for(count = 0; count <= 200; count++)
+ {
+ Step = Phase_2[count%4];
+ wait(0.005);
+ }
+ Step = 0;
+ wait(2);
+ // CCW(-360deg)
+ for(count = 200; count >= 0; count--)
+ {
+ Step = Phase_2[count%4];
+ wait(0.005);
+ }
+ Step = 0;
+ wait(2);
+ }
+}