As used for motor testing May / June 2016

Dependencies:   iC_MU mbed-rtos mbed

Fork of SweptSine by Vitec Group

Pan_Feedback.cpp

Committer:
acodd
Date:
2016-06-08
Revision:
3:463edcfc09c5

File content as of revision 3:463edcfc09c5:

#include "mbed.h"
#include "rtos.h"

float Pan_count = 1000;

InterruptIn pan_pulser(p30); // Pulse counter for Pan axis in this case 10 counts per rev. NOTE!! this has to be 3.3V,

void func_fall(void)
{
    // pc.printf("fall.\n\r");
    //Pan_count = Pan_count -1000;
    if (Pan_count > 0) {
        Pan_count = 0;
    } else {
        Pan_count = 1000;
    }
}
void func_rise(void)
{
    //pc.printf("rise.\n\r");
    //Pan_count = Pan_count +1000;
    if (Pan_count > 0) {
        Pan_count = 0;
    } else {
        Pan_count = 1000;
    }
}

void Pan_Counter(void const *args)
{
    pan_pulser.fall(&func_fall);
    pan_pulser.rise(&func_rise);
}