Samenwerking Groep 12

Dependencies:   Encoder MODSERIAL HIDScope mbed

Foo

main.cpp

Committer:
bscheltinga
Date:
2015-09-21
Revision:
3:61c024f896ad
Parent:
2:3de3c5eb400f
Child:
4:a92d354265b2

File content as of revision 3:61c024f896ad:

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

//Motor 2
DigitalOut motor2direction(D4); //D4 en D5 zijn motor 2 (op het motorshield)
PwmOut motor2speed(D5);
DigitalIn button(PTA4);

int main()
{
    while(true) {
        if (button.read() == 0) {   //if button pressed
            motor2direction = 1;
            motor2speed = 0.3f;
        } else {                    // If button is not pressed
            motor2direction = 0;
            motor2speed = 0.3f;
        }
        double position = getPosition();
        printf("positie = %d", position);
    }
}

// Geen functie hieronder nog
// Encoder encoder1(D13,D12);