javier vicente / Mbed 2 deprecated MASTER_STEPPER

Dependencies:   mbed

main.cpp

Committer:
javiervicente
Date:
2020-12-09
Revision:
1:52b7ac862f35
Parent:
0:2ef3f0a3ce31

File content as of revision 1:52b7ac862f35:

#include "mbed.h"

Serial pc(USBTX, USBRX); // tx, rx


DigitalOut led(LED1);
DigitalOut step(D13);
DigitalOut dir(D12);
DigitalOut enable(D11);


int main()
{
    pc.baud(115200);
    enable=1;
    wait(1.0);
    while(1) {
        dir=1;
        for(int n=0; n<4000; n++) {
            step=1;
            wait_us(100);
            step=0;
            wait_us(900);
        }
        wait(2);
        dir=0;
        for(int n=0; n<4000; n++) {
            step=1;
            wait_us(100);
            step=0;
            wait_us(900);
        }
        led = !led;
        wait(2);
    }
}