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: step.cpp
- Revision:
- 0:a555aed9e725
diff -r 000000000000 -r a555aed9e725 step.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/step.cpp Mon Jan 09 14:13:32 2017 +0000
@@ -0,0 +1,37 @@
+#include "mbed.h"
+#include "uStep.h"
+Ticker ticki;
+DigitalIn buttondown(PTE30);
+DigitalIn buttonup(PTC2);
+DigitalOut andrijinkriz1(PTE29);
+DigitalOut andrijinkriz2(PTE23);
+
+uStep motor(PTB8, PTB9,PTB10, PTB11);
+
+void task1(void)
+{
+ andrijinkriz1=!andrijinkriz1;
+ andrijinkriz2=!andrijinkriz1;
+}
+int step_brzina = 2000;
+int numstep = 512 ;
+
+int main()
+{
+ while (1) {
+ if(buttondown==0) {
+ ticki.attach(&task1,0.5);
+ motor.step(numstep/4,0,step_brzina);
+
+
+ }
+ if(buttonup==0) {
+
+ motor.step(numstep/4,1,step_brzina);
+ ticki.detach();
+ andrijinkriz1=0;
+ andrijinkriz2=0;
+
+ }
+ }
+}
\ No newline at end of file