Advertisement
FlyFar

upd-control.js

Mar 16th, 2023
681
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 0.51 KB | Cybersecurity | 0 0
  1. // Run this to make your drone take off for 5 seconds and then land itself
  2. // again.
  3.  
  4. var UdpControl = require('../lib/control/UdpControl');
  5.  
  6. var control   = new UdpControl();
  7. var fly       = true;
  8. var emergency = true;
  9.  
  10. setInterval(function() {
  11.   control.ref({fly: fly, emergency: emergency});
  12.   control.pcmd();
  13.   control.flush();
  14. }, 30);
  15.  
  16. // For the first second, disable emergency if there was one
  17. setTimeout(function() {
  18.   emergency = false;
  19. }, 1000);
  20.  
  21. setTimeout(function() {
  22.   fly = false;
  23. }, 5000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement