Final

Dependencies:   mbed

Fork of MiniProject5_LightTracker by Austin Sloop

main.cpp

Committer:
asloop18
Date:
2016-01-12
Revision:
12:7bc0afbc651a
Parent:
11:7b3d64a66efd
Child:
13:871d01d0d250

File content as of revision 12:7bc0afbc651a:

/*Project to make a servo aim to perpendicular photoresistors at a light source, and display the angle of the source to the servo
 Project and code by Preston Stephens and Austin Sloop, Inspired by Dr. Larkin.   1/11/16
*/

#include "mbed.h"
#include "SegDisplay.h"
#include "ServoControl.h"

AnalogIn sensor1(p19);
AnalogIn sensor2(p20);

float angle;

int main(){
    SegInit();
    ServoInit();

    if(sensor1>sensor2){angle=angle+1;}
    if(sensor1>sensor2){angle=angle+1;}
    ServoControl(angle);
    SegDisplay(10,1);
}