Kill Switch not operating



  • I have a STEM class and the students are working through the CoDrone lessons. The problem that they are having (me as well) is that the Kill Switch is not operating. The lesson 2D has the kill switch code incorporated in it but when you run the code the drone will perform the code(most times) but when it doesn't and the kill switch is used nothing happens. What are we doing wrong???? Please help 🙂



  • Hi @rcron2! I'm wondering if maybe your sensors aren't adjusted, so maybe the IR sensors aren't picking up that something is in front of it, so it won't trigger.

    Can you post the code you're using? I'm assuming it's the same code as the example code in 2D, but I want to be sure.

    Also, there's a white dial on the Smart Inventor board. If you turn it to the right, your sensors will get more sensitive, and if you turn it to the left, they become less sensitive. Give that a shot, to see if the killswitch is actually triggering. If you're on the latest version of our library ("CoDrone" version 2.0.1 in the Library Manager), you should hear a sound effect for the killswitch. If you still don't see a response, let me know, and we can see if we need to set up a call.


  • administrators

    Hello @rcron2 the code

    #include <CoDrone.h>
    
    void setup() {
       CoDrone.begin(115200);
       CoDrone.pair();
    
       CoDrone.takeoff(); //goes up and hovers for 3 seconds
       CoDrone.hover(2); //hovers for 2 seconds
       CoDrone.land(); //lands the CoDrone 
    }
    
    void loop(){    
       byte bt8 = digitalRead(18);    
       byte bt4 = digitalRead(14);    
       byte bt1 = digitalRead(11);
    
       if(bt1 && bt4 && !bt8){    
       CoDrone.emergencyStop();
       }
    }
    

    has a killswitch inside the loop, since the setup code is doing one line after another it will take time to get to the inside of the loop. The killswitch is there for once the program is over if the CoDrone is still flying you can make it land. You can also double-click the BLE modules black button to kill the drone mid-program. Let me know if you have any other questions.


Log in to reply
 

Looks like your connection to Robolink community was lost, please wait while we try to reconnect.