Draaiende motor op commando van knopje (WERKEND)11

Dependencies:   Encoder MODSERIAL mbed

Fork of P_controller_motor_Bouke by Thomas Burgers

main.cpp

Committer:
ThomasBNL
Date:
2015-09-21
Revision:
13:e9ed79fc60f3
Parent:
12:27abe8ee588c

File content as of revision 13:e9ed79fc60f3:

#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.5) {
            motor2direction = 1;
            motor2speed = 0.2f;
        } else {
            motor2direction = 0;
            motor2speed = 0.3f;
        }
    }
}

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