javier vicente / Mbed 2 deprecated MASTER_STEPPER

Dependencies:   mbed

Committer:
javiervicente
Date:
Wed Dec 09 17:22:58 2020 +0000
Revision:
1:52b7ac862f35
Parent:
0:2ef3f0a3ce31
ff

Who changed what in which revision?

UserRevisionLine numberNew contents of line
javiervicente 0:2ef3f0a3ce31 1 #include "mbed.h"
javiervicente 0:2ef3f0a3ce31 2
javiervicente 0:2ef3f0a3ce31 3 Serial pc(USBTX, USBRX); // tx, rx
javiervicente 0:2ef3f0a3ce31 4
javiervicente 0:2ef3f0a3ce31 5
javiervicente 0:2ef3f0a3ce31 6 DigitalOut led(LED1);
javiervicente 1:52b7ac862f35 7 DigitalOut step(D13);
javiervicente 1:52b7ac862f35 8 DigitalOut dir(D12);
javiervicente 1:52b7ac862f35 9 DigitalOut enable(D11);
javiervicente 0:2ef3f0a3ce31 10
javiervicente 0:2ef3f0a3ce31 11
javiervicente 0:2ef3f0a3ce31 12 int main()
javiervicente 0:2ef3f0a3ce31 13 {
javiervicente 0:2ef3f0a3ce31 14 pc.baud(115200);
javiervicente 0:2ef3f0a3ce31 15 enable=1;
javiervicente 0:2ef3f0a3ce31 16 wait(1.0);
javiervicente 0:2ef3f0a3ce31 17 while(1) {
javiervicente 0:2ef3f0a3ce31 18 dir=1;
javiervicente 0:2ef3f0a3ce31 19 for(int n=0; n<4000; n++) {
javiervicente 0:2ef3f0a3ce31 20 step=1;
javiervicente 0:2ef3f0a3ce31 21 wait_us(100);
javiervicente 0:2ef3f0a3ce31 22 step=0;
javiervicente 0:2ef3f0a3ce31 23 wait_us(900);
javiervicente 0:2ef3f0a3ce31 24 }
javiervicente 0:2ef3f0a3ce31 25 wait(2);
javiervicente 0:2ef3f0a3ce31 26 dir=0;
javiervicente 0:2ef3f0a3ce31 27 for(int n=0; n<4000; n++) {
javiervicente 0:2ef3f0a3ce31 28 step=1;
javiervicente 0:2ef3f0a3ce31 29 wait_us(100);
javiervicente 0:2ef3f0a3ce31 30 step=0;
javiervicente 0:2ef3f0a3ce31 31 wait_us(900);
javiervicente 0:2ef3f0a3ce31 32 }
javiervicente 0:2ef3f0a3ce31 33 led = !led;
javiervicente 0:2ef3f0a3ce31 34 wait(2);
javiervicente 0:2ef3f0a3ce31 35 }
javiervicente 0:2ef3f0a3ce31 36 }
javiervicente 0:2ef3f0a3ce31 37
javiervicente 0:2ef3f0a3ce31 38