ROBOTC.net forums
http://robotc.net/forums/

Perfect Cable Winding Mechanism Code Script
http://robotc.net/forums/viewtopic.php?f=1&t=13335
Page 1 of 1

Author:  SWEETMUSK [ Sat Feb 06, 2016 12:22 am ]
Post subject:  Perfect Cable Winding Mechanism Code Script

Cable Winding Mechanism
A telecommunications contractor need you team design a device that can accurately wind up a specific length of cable.
The device must be able to wind a specific length consistently. The device must also be able to be started and stopped(emergency) by using a switch.

I want to share my first project that I did for my cable winding mechanism
This machine will go down or up by press bump1 or bump2, also it can change the directions when I press different bumps
Sonar1 controls the length of down and sonar2 controls the length of up
Machine will stop winding no matter what when I press limitswitch, and it will start again by press either bumps
The max and min range for this winding machine is 20cm~60cm, it won't go more or less

This is very accurate(+-1cm) and much better than use encoder, because it won't get effect by the rope axis

Code:
   while(1==1)
   {
      while(SensorValue(Sonar1)<60 && SensorValue(limit)==0   && SensorValue(bump2)==0)
      {
         if(SensorValue(bump1)==1)
         {
            stopMotor(Motor);
            wait(0.2);
            startMotor(Motor, 63);
         }
      }

      stopMotor(Motor);

      while(SensorValue(Sonar2)>20 && SensorValue(limit)==0 && SensorValue(bump1)==0)
      {
         if(SensorValue(bump2)==1)
         {
            stopMotor(Motor);
            wait(0.2);
            startMotor(Motor, -63);
         }
      }


      stopMotor(Motor);

   }


Hope you will like, thank you. :lol:

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/