pot controller voor positie, kp handmatig instellen, werkt met motor 1 en 2

Dependencies:   MODSERIAL QEI mbed-dsp mbed

Fork of PI_controller_verbeteringen by ProjectGroep23

main.cpp

Committer:
SimonRez
Date:
2018-09-24
Revision:
5:f07bafaf11d7
Parent:
4:651d06e860e7
Child:
6:1ee8795b7578

File content as of revision 5:f07bafaf11d7:

#include "mbed.h"
#include "MODSERIAL.h"

Ticker Blinker;

DigitalOut ledr(LED_RED);
DigitalOut ledg(LED_GREEN);
DigitalOut ledb(LED_BLUE);

PwmOut  pwmpin(PTA2);
DigitalOut direct(PTB23);
AnalogIn enc1(A0);

InterruptIn  sw2(SW2);
InterruptIn  sw3(SW3);

MODSERIAL pc(USBTX, USBRX);


int main()
{
    ledr = 1;
    ledg = 1;
    ledb = 1;
    
    pc.printf("\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n ~~~A$$De$troyer69~~~ \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n");
    
    pwmpin.period_us(60);
    pwmpin = 0;
  
    while (true)
    {
            pwmpin.write(enc1.read());
            direct = 1;
            pc.printf("%f \r\n", enc1.read());
            wait(0.2f);
    }
}