You are not connected. Please login or register

VEX TumblerBot

How difficult was this for you?

0% 0% [ 0 ]
0% 0% [ 0 ]
100% 100% [ 1 ]
0% 0% [ 0 ]
0% 0% [ 0 ]
Total Votes : 1

View previous topic View next topic Go down  Message [Page 1 of 1]

1Important VEX TumblerBot on Wed May 22, 2013 9:12 pm

Collin

avatar
Administrator
Administrator
The TumblerBot is a robot project that you build and program.

You can find the instructions here: http://www.rose-prism.org/moodle/pluginfile.php/310846/mod_resource/content/1/VEX%20Tumbler%20-%20PIC.pdf

Here is the code I used:
Code:

#pragma config(Sensor, in2,    frontSensor,    sensorTouch)
#pragma config(Sensor, in8,    frontLed,       sensorLEDtoVCC)
#pragma config(Motor,  port1,           rightMotor1,   tmotorServoContinuousRotation, openLoop)
#pragma config(Motor,  port2,           leftMotor2,    tmotorServoContinuousRotation, openLoop)
#pragma config(Motor,  port3,           frontMotor,    tmotorServoContinuousRotation, openLoop)
#pragma config(Motor,  port5,           leftflashlight, tmotorVexFlashlight, openLoop, reversed)
#pragma config(Motor,  port6,           rightflashlight, tmotorVexFlashlight, openLoop, reversed)
#pragma config(Motor,  port7,           leftMotor4,    tmotorServoContinuousRotation, openLoop)
#pragma config(Motor,  port8,           rightMotor3,   tmotorServoContinuousRotation, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main()
{

   bMotorFlippedMode[port1] = false;    //Port 1 Motor Direction Flipped
   bMotorFlippedMode[port8] = false;    //Port 8 Motor Direction Flipped
   bMotorFlippedMode[port2] = true;    //Port 2 Motor Direction Flipped
   bMotorFlippedMode[port7] = true;    //Port 7 Motor Direction Flipped
   bVexAutonomousMode = false;           //Activates Remote Control Mode



  while(1 == 1)
  {
     motor[leftMotor2] = vexRT[Ch3] / 2;
     motor[leftMotor4] = vexRT[Ch3] / 2;
     motor[rightMotor1] = vexRT[Ch2] / 2;
     motor[rightMotor3] = vexRT[Ch2] / 2;
     motor[leftflashlight] = vexRT[Ch5] / 1;
     motor[rightflashlight] = vexRT[Ch5] / 1;
     motor[frontMotor] = vexRT[Ch4] / 2;
    }
   
   while(vexRT[Ch5] == 127 || frontSensor == 1)
   {
      motor[leftflashlight] = 127;    //Begin Left Strobe
      wait(0.125);
      motor[leftflashlight] = 0;
      wait(0.125);
       motor[leftflashlight] = 127;
      wait(0.125);
      motor[leftflashlight] = 0;
      wait(0.125);
      motor[leftflashlight] = 127;
      wait(0.125);
      motor[leftflashlight] = 0;
      wait(0.125);
      motor[rightflashlight] = 127; //Begin Right Strobe
      wait(0.125);
      motor[rightflashlight] = 0;
      wait(0.125);
      motor[rightflashlight] = 127;
      wait(0.125);
      motor[rightflashlight] = 0;
      wait(0.125);
      motor[rightflashlight] = 127;
      wait(0.125);
      motor[rightflashlight] = 0;
      wait(0.125);
      motor[leftflashlight] = 127;    //Begin Left Strobe
      wait(0.125);
      motor[leftflashlight] = 0;
      wait(0.125);
       motor[leftflashlight] = 127;
      wait(0.125);
      motor[leftflashlight] = 0;
      wait(0.125);
      motor[leftflashlight] = 127;
      wait(0.125);
      motor[leftflashlight] = 0;
      wait(0.125);
      motor[rightflashlight] = 127; //Begin Right Strobe
      wait(0.125);
      motor[rightflashlight] = 0;
      wait(0.125);
      motor[rightflashlight] = 127;
      wait(0.125);
      motor[rightflashlight] = 0;
      wait(0.125);
      motor[rightflashlight] = 127;
      wait(0.125);
      motor[rightflashlight] = 0;
      wait(0.125);
      motor[leftflashlight] = 127; //Begin Alternate Strobe
      wait(0.125);
      motor[leftflashlight] = 0;
      wait(0.125);
      motor[rightflashlight] = 127;
      wait(0.125);
      motor[rightflashlight] = 0;
      wait(0.125);
      motor[leftflashlight] = 127;
      wait(0.125);
      motor[leftflashlight] = 0;
      wait(0.125);
      motor[rightflashlight] = 127;
      wait(0.125);
      motor[rightflashlight] = 0;
      wait(0.125);
      motor[leftflashlight] = 127;
      wait(0.125);
      motor[leftflashlight] = 0;
      wait(0.125);
      motor[rightflashlight] = 127;
      wait(0.125);
      motor[rightflashlight] = 0;
      wait(0.125);
   } //loop
   
   while(1==1)
   {
      turnLEDOn(in8);
      wait(0.5);
      turnLEDOff(in8);
      wait(1);
      turnLEDOn(in7);
      wait(0.5);
      turnLEDOff(in7);
      wait(1);
   }
}

This code includes a strobe effect for two VEX Flashlights. It also includes a section of code for LEDS that are about the same shape and size as the jumpers.

TOPIC LOCKED


_________________
View user profile http://imtv.forumotion.com

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum