kh

Dependencies:   mbed PinDetect Servo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers actuators.cpp Source File

actuators.cpp

00001 /*
00002 * Authors: Group 4 Adam Elghor, Brian Kaplan, Sayak Chatterjee, Moraa Onwonga
00003 * Purpose: Controls the actuators of the safe
00004 * Language:  NBC
00005 */
00006 #include "actuators.h"
00007 #include "parameters.h"
00008 #include "Servo.h"
00009 
00010 
00011 Servo rcServo1(p21); // pwm
00012 Servo rcServo2(p22); // pwm
00013 Servo middle(p23);
00014 
00015 /*
00016 * Function:  turnsRcServosRight
00017 * --------------------
00018 *  Turns the servos to the right
00019 *
00020 *
00021 */
00022 void turnsRcServosRight() {
00023     printf("I entered turnsRCServoRight");
00024     rcServo1 = 1.0f;
00025     rcServo2 = 1.0f;
00026 }
00027 
00028 /*
00029 * Function:  urnsRcServosLeft
00030 * --------------------
00031 *  Turns the servos to the right
00032 *
00033 *
00034 */
00035 void turnsRcServosLeft() {
00036     rcServo1 = 0.0f;
00037     rcServo2 = 0.0f;
00038 }
00039 
00040 
00041 /*
00042 * Function:  openSafe
00043 * --------------------
00044 *  Opens the safe
00045 */
00046 void openSafe() {
00047     middle = 1.0f;
00048     wait(1);
00049     turnsRcServosRight();
00050 }
00051 
00052 /*
00053 * Function:  lockSafe
00054 * --------------------
00055 *  Locks the safe
00056 */
00057 void lockSafe() {
00058     turnsRcServosLeft();
00059     wait(3);
00060     middle = 1.0f;
00061 }
00062 
00063