homing
Dependencies: mbed
main.cpp
- Committer:
- kweisbeek
- Date:
- 2018-11-01
- Revision:
- 0:49f7a745f758
- Child:
- 1:555373c1b9be
File content as of revision 0:49f7a745f758:
#include "mbed.h" //positie van start punten in counts double rotation_end_position=1; double tower_1_position=1; double tower_end_position=1; const int revcount = 25*8400; // void home(){ //translation home if (counts2 > ((tower_end_position - tower_1_position)/2){ translation_start(0,1); } else { translation_start(1,1); } if (counts2 > ((tower_end_position - tower_1_position)/2 - 100){ if (counts2 < ((tower_end_position - tower_1_position)/2 + 100){ translation_stop() } else{} } else{} //rotation home rotation_start(); if ((counts1 - (revcount * (counts1 / revcounts))) > (rotation_end_position - 100)){ //check if motor 1 is in the right position within 100 counts range if ((counts1 - (revcount * (counts1 / revcounts))) < (rotation_end_position + 100)){ rotation_stop(); } else {} } else {} }