Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // THIS IS THE PAYLOAD CODE: https://pastebin.com/0psPbddR
- // THIS IS THE STRUCTURE CODE: https://pastebin.com/4kFdj932
- // THIS IS THE DESCENT CODE: https://pastebin.com/jwbtCfT4
- //importing EYW
- #include <EYW.h>
- //Section of payload variables
- EYW Camera::Camera cameraservo;
- bool timing = true;
- int
- //Section for structure variables
- EYW::Altimeter altimeter;
- float currentHeight = 0;
- int structButtonPin = 2;
- int structLedPin = 4;
- int structSpeakerPin = 5;
- int frequency = 880;
- int duration = 1000;
- //Section for descent variables
- EYW::RangeFinder descent;
- int descButtonPin = 2;
- int distanceFromGround = 0;
- int descLedPin = 4;
- int descSpeakerPin = 5;
- int descTriggerPin = 6;
- int descEchoPin = 7;
- //Payload's timer system because EYW's is bad
- void Timer(int delayTime)
- {
- for (int i=0; i <= delayTime; i++)
- {
- timing = true;
- delay(1);
- }
- timing = false;
- }
- void setup() {
- //Setting the serial montitor speed
- Serial.begin(9600);
- //Starting payload stuff
- cameraservo.begin();
- cameraservo.calibrate();
- cameraservo.alarm();
- //Starting descent stuff
- descent.begin(descButtonPin, descLedPin, descSpeakerPin, descTriggerPin, descEchoPin);
- descent.calibrate(10);
- descent.alarm();
- //Starting structure stuff
- altimeter.begin(structButtonPin, structLedPin, structSpeakerPin);
- altimeter.calibrate(100);
- altimeter.alarm();
- //Starting the payload's timer
- Timer(1000);
- }
- void loop() {
- if (timing == false || cameraservo.buttonPressed() == true) {
- cameraservo.getPicture();
- Timer(5000);
- }
- currentHeight = altimeter.getHeightAvg(20);
- Serial.print("Current Height: ")
- Serial.println(currentHeight)
- if (currentHeight) {
- altimeter.alarm(6,2000,500);
- }
- distanceFromGround = descent.getDistance();
- Serial.print("CurrentDistance: ")
- Serial.println(distanceFromGround)
- if (distance<10) {
- descent.alarm(2,2000,100)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement