Werkcollege opgave 23 september BMT K9

Dependencies:   Encoder HIDScope MODSERIAL mbed QEI biquadFilter

main.cpp

Committer:
bscheltinga
Date:
2015-09-30
Revision:
6:ca89d5e17328
Parent:
5:d60a42727a3e
Child:
8:be449365de62

File content as of revision 6:ca89d5e17328:

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

DigitalOut motor2direction(D4); //D4 en D5 zijn motor 2 (op het motorshield)
PwmOut motor2speed(D5);
DigitalIn buttonL1(PTC6);
DigitalIn buttonL2(PTA4);
DigitalIn buttonH1(D2);
DigitalIn buttonH2(D6);
AnalogIn potmeter(A1);

MODSERIAL.pc (USBTX,USBRX);


int main()
{
pc.baud (9600);
    while(true) {
        double n = (potmeter.read()/300);
        motor2direction = 1;
        motor2speed = n;
        pc.printf("motor2speed = %d", n);
    }
}