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.
step.cpp
- Committer:
- inovak1
- Date:
- 2017-01-09
- Revision:
- 0:a555aed9e725
File content as of revision 0:a555aed9e725:
#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;
}
}
}