Dependencies:   Servo mbed

main.cpp

Committer:
jordaahh
Date:
2017-02-07
Revision:
2:baf8a7b2b150
Parent:
0:b5ce567b469c
Child:
3:306d3725ed04

File content as of revision 2:baf8a7b2b150:

// Hello World to sweep a servo through its full range

#include "mbed.h"
#include "Servo.h"
#include "SystemFunctions.h"

Servo servo1(p21); // PWM out to servo in first axis (Solar Azimuth)
Servo servo2(p22); // PWM out to servo in second axis (Solar Altitude) 

AnalogIn pot(p20);  // Linear pot input for manual control [initial circuit] 

AnalogIn LDR1(p15); // Top Left LDR
AnalogIn LDR2(p16); // Top Right LDR
AnalogIn LDR3(p17); // Bottom Left LDR
AnalogIn LDR4(p18); // Bottom Right LDR

int main() {    

    servo1.calibrate(range, 45.0); // *****check this fucntion******
    
    while(1){
        // initial code for testing one servo with a linear potentiometer.  
        position = pot; 
        wait_ms(0.5);
        servo1 = position;
        }
}