Final

Dependencies:   mbed

Fork of MiniProject5_LightTracker by Austin Sloop

Committer:
asloop18
Date:
Tue Jan 12 00:06:10 2016 +0000
Revision:
12:7bc0afbc651a
Parent:
11:7b3d64a66efd
Child:
13:871d01d0d250
Some notation;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
asloop18 12:7bc0afbc651a 1 /*Project to make a servo aim to perpendicular photoresistors at a light source, and display the angle of the source to the servo
asloop18 12:7bc0afbc651a 2 Project and code by Preston Stephens and Austin Sloop, Inspired by Dr. Larkin. 1/11/16
asloop18 12:7bc0afbc651a 3 */
asloop18 0:68508074b5d5 4
asloop18 0:68508074b5d5 5 #include "mbed.h"
pstephens18 1:8e14c2404f45 6 #include "SegDisplay.h"
asloop18 8:96b30706335b 7 #include "ServoControl.h"
asloop18 0:68508074b5d5 8
asloop18 10:b7cebc1f3768 9 AnalogIn sensor1(p19);
asloop18 10:b7cebc1f3768 10 AnalogIn sensor2(p20);
asloop18 10:b7cebc1f3768 11
asloop18 9:daeae936f9ec 12 float angle;
asloop18 9:daeae936f9ec 13
asloop18 2:d50d55831d50 14 int main(){
pstephens18 11:7b3d64a66efd 15 SegInit();
pstephens18 11:7b3d64a66efd 16 ServoInit();
asloop18 10:b7cebc1f3768 17
asloop18 10:b7cebc1f3768 18 if(sensor1>sensor2){angle=angle+1;}
asloop18 10:b7cebc1f3768 19 if(sensor1>sensor2){angle=angle+1;}
asloop18 10:b7cebc1f3768 20 ServoControl(angle);
pstephens18 11:7b3d64a66efd 21 SegDisplay(10,1);
pstephens18 11:7b3d64a66efd 22 }
asloop18 10:b7cebc1f3768 23