Botsingdetectie.java 751 B

12345678910111213141516171819202122232425262728293031323334
  1. package boebot;
  2. public class Botsingdetectie{
  3. private IrDetectie irL;
  4. private IrDetectie irR;
  5. private VsDetectie vsL;
  6. private VsDetectie vsR;
  7. private boolean IrDetectL;
  8. private boolean IrDetectR;
  9. private boolean VsDetectL;
  10. private boolean VsDetectR;
  11. public Botsingdetectie(){
  12. irL = new IrDetectie(8, 9);
  13. irR = new IrDetectie(2, 0);
  14. vsL = new VsDetectie(8, 9);
  15. vsR = new VsDetectie(2, 0);
  16. }
  17. public boolean detectEdge(){
  18. IrDetectL = irL.detect();
  19. IrDetectR = irR.detect();
  20. VsDetectL = vsL.detect();
  21. VsDetectR = vsR.detect();
  22. if(IrDetectL || IrDetectR || VsDetectL || VsDetectR){
  23. return true;
  24. }else{
  25. return false;
  26. }
  27. }
  28. }