
Safe of the God's was a group project. For the project we were given the task to create an electronic safe with an embedded system.
Dependencies: mbed Servo PinDetect
Diff: src/actuators.cpp
- Revision:
- 4:628468ce3e86
- Parent:
- 3:2f7a7e2cd49e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/actuators.cpp Sat Dec 29 07:04:53 2018 +0000 @@ -0,0 +1,63 @@ +/* +* Authors: Group 4 Adam Elghor, Brian Kaplan, Sayak Chatterjee, Moraa Onwonga +* Purpose: Controls the actuators of the safe +* Language: C++ +*/ +#include "actuators.h" +#include "parameters.h" +#include "Servo.h" + + +Servo rcServo1(p21); // pwm +Servo rcServo2(p22); // pwm +Servo middle(p23); + +/* +* Function: turnsRcServosRight +* -------------------- +* Turns the servos to the right +* +* +*/ +void turnsRcServosRight() { + printf("I entered turnsRCServoRight"); + rcServo1 = 1.0f; + rcServo2 = 1.0f; +} + +/* +* Function: turnsRcServosLeft +* -------------------- +* Turns the servos to the right +* +* +*/ +void turnsRcServosLeft() { + rcServo1 = 0.0f; + rcServo2 = 0.0f; +} + + +/* +* Function: openSafe +* -------------------- +* Opens the safe +*/ +void openSafe() { + middle = 1.0f; + wait(1); + turnsRcServosRight(); +} + +/* +* Function: lockSafe +* -------------------- +* Locks the safe +*/ +void lockSafe() { + turnsRcServosLeft(); + wait(3); + middle = 1.0f; +} + +