View unanswered posts | View active topics It is currently Wed Oct 07, 2015 9:17 am

Reply to topic  [ 2 posts ] 
Servo not stopping 
Author Message

Joined: Wed Jan 28, 2015 7:39 pm
Posts: 5
Post Servo not stopping
Our servo can turn on but it won't stop moving please help us. :crying:
#pragma config(Hubs,  S1, HTMotor,  HTServo,  none,     none)
#pragma config(Sensor, S1,     ,               sensorI2CMuxController)
#pragma config(Sensor, S2,     ,               sensorHiTechnicIRSeeker600)
#pragma config(Motor,  mtr_S1_C1_1,     A,             tmotorTetrix, openLoop, reversed)
#pragma config(Motor,  mtr_S1_C1_2,     B,             tmotorTetrix, openLoop)
#pragma config(Servo,  srvo_S1_C2_1,    stickstand,           tServoStandard)
#pragma config(Servo,  srvo_S1_C2_2,    hooker,               tServoStandard)
#pragma config(Servo,  srvo_S1_C2_3,    servo3,               tServoNone)
#pragma config(Servo,  srvo_S1_C2_4,    servo4,               tServoNone)
#pragma config(Servo,  srvo_S1_C2_5,    servo5,               tServoNone)
#pragma config(Servo,  srvo_S1_C2_6,    servo6,               tServoNone)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

//                           Tele-Operation Mode Code Template
// This file contains a template for simplified creation of an tele-op program for an FTC
// competition.
// You need to customize two functions with code unique to your specific robot.

#include "JoystickDriver.c"  //Include file to "handle" the Bluetooth messages.

//                                    initializeRobot
// Prior to the start of tele-op mode, you may want to perform some initialization on your robot
// and the variables within your program.
// In most cases, you may not have to add any code to this function and it will remain "empty".

void initializeRobot()
  // Place code here to sinitialize servos to starting positions.
  // Sensors are automatically configured and setup by ROBOTC. They may need a brief time to stabilize.


//                                         Main Task
// The following is the main code for the tele-op robot operation. Customize as appropriate for
// your specific robot.
// Game controller / joystick information is sent periodically (about every 50 milliseconds) from
// the FMS (Field Management System) to the robot. Most tele-op programs will follow the following
// logic:
//   1. Loop forever repeating the following actions:
//   2. Get the latest game controller / joystick settings that have been received from the PC.
//   3. Perform appropriate actions based on the joystick + buttons settings. This is usually a
//      simple action:
//      *  Joystick values are usually directly translated into power levels for a motor or
//         position of a servo.
//      *  Buttons are usually used to start/stop a motor or cause a servo to move to a specific
//         position.
//   4. Repeat the loop.
// Your program needs to continuously loop because you need to continuously respond to changes in
// the game controller settings.
// At the end of the tele-op period, the FMS will autonmatically abort (stop) execution of the program.

task main()

  waitForStart();   // wait for start of tele-op phase

  while (true)
      motor[A] = joystick.joy1_x1;
      motor[A] = joystick.joy1_y1;
motor[B] = joystick.joy1_x2;
motor[B] = joystick.joy1_y2;
if(joy1Btn(7) == 1){servo[stickstand] = 255;
   servo[stickstand] = 255;}
   if(joy1Btn(8) == 1){servo[stickstand] = -255;
      servo[stickstand] = -255;}
      if(joy1Btn(5) == 1){
  if(joy1Btn(4) == 1){servo[hooker] = 255;};
  if(joy1Btn(2) == 1){servo[hooker] = -255;};

Sat Jan 31, 2015 3:28 pm

Joined: Tue Jan 13, 2015 10:48 pm
Posts: 23
Post Re: Servo not stopping
Check your physical servo. You probably put in a continuous rotation servo instead of a regular one. Also, you can only assign a servo a value between 0 and positive 255. To program a continuous rotation servo, it is everything below 127 is backwards, everything above it is forwards, and 127 is stop moving. Since you assigned a value of 255 to the CR servo and never stopped it, the while true loop keeps it moving.

Sat Jan 31, 2015 4:32 pm
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.