|
Page 1 of 1
|
[ 6 posts ] |
|
is there anything wrong with this code?
| Author |
Message |
|
monticellorobotics
Rookie
Joined: Thu Nov 06, 2008 6:00 pm Posts: 4
|
 is there anything wrong with this code?
we see variables changing in the debugger but the servos don't move??  |  |  |  | Code: #pragma config(Hubs, S1, HTMotor, HTServo, none, none) #pragma config(Motor, mtr_S1_C1_1, motorD, tmotorNormal, openLoop, ) #pragma config(Motor, mtr_S1_C1_2, motorE, tmotorNormal, openLoop, ) #pragma config(Servo, servo1, right_lift, tServoNormal)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#include "JoystickDriver.c" //Include file to "handle" the BT messages.
task main() { while (true) //Loop forever { getJoystickSettings(joystick);
motor[motorD] = joystick.joy1_y1; motor[motorE] = joystick.joy1_y2;
servo[right_lift] = joystick.joy2_y1;
} }
|  |  |  |  |
|
| Mon Dec 01, 2008 6:13 pm |
|
 |
|
tfriez
Site Admin
Joined: Wed Jan 24, 2007 10:42 am Posts: 537
|
 Re: is there anything wrong with this code?
If using ROBOTC 1.40, upgrade to 1.46 (link at top of forum)
If using 1.46, check wiring on Servo Controller. Looks like the servo should be attached behind the motor controller on Sensor Port 1.
_________________Timothy Friez ROBOTC Developer - SW Engineer tfriez@robotc.net
|
| Mon Dec 01, 2008 6:16 pm |
|
 |
|
l0jec
Expert
Joined: Mon Oct 27, 2008 9:59 pm Posts: 137
|
 Re: is there anything wrong with this code?
I only see one obvious bug and that is the servo takes values from 0 to 256 and joystick.joy2_y1 is going to give you values from -128 to +128. You can just add a constant 128 to the value sent to the servo to fix this.
Otherwise, I'm with tfriez... check your wiring. If the motors work and only the servo doesn't, make sure the servo is plugged into the servo controller correctly (the yellow wire pointing towards the I/O ports). Also, make sure the servo isn't just overweighted to move...
|
| Mon Dec 01, 2008 7:01 pm |
|
 |
|
monticellorobotics
Rookie
Joined: Thu Nov 06, 2008 6:00 pm Posts: 4
|
 Re: is there anything wrong with this code?
thanks folks. we appreciate your advice and help.
we have robotc 1.46. one oddity is that we can't get the latest NXT firmware to work properly, so we are on the only other firmware we have...i'm home now and don't have firmware numbers. how critical is that?
we did the +128 at one point and that didn't get a response, but that certainly makes sense so we'll add that back.
we can clearly see the values in the servo debugging window changing. we've also tried flipping the wire around going into the servo controller and tried it both ways. we weren't sure which way was the right way (thanks for that tip).
we don't have any weight on the servo at all for our testing purposes.
the wiring that was in the photo diagram that was shared with us in our first post a while back is how we have things wired.
i wonder if we have a bad servo or servo controller?
we were wondering about the top line of code in the configuration
we have:
#pragma config(Servo, servo1, right_lift, tServoNormal)
we've also seen something like this:
#pragma config(Servo, srv_S1_C1_1, right_lift, tServoNormal)
does that matter?
thanks again for all your advice and help.
|
| Mon Dec 01, 2008 8:25 pm |
|
 |
|
10nisman94
Novice
Joined: Mon Oct 13, 2008 6:29 pm Posts: 75 Location: Florida, USA
|
 Re: is there anything wrong with this code?
we had the same problem, this means that one of your serv wires is reversed
_________________ PHUHS Robotics Team 516 FTW
Daytona Robofest Winning Alliance Captain Daytona Robofest Inspire Award
|
| Thu Dec 04, 2008 5:34 pm |
|
 |
|
monticellorobotics
Rookie
Joined: Thu Nov 06, 2008 6:00 pm Posts: 4
|
 Re: is there anything wrong with this code?
we did solve our problem...
though we had intalled 1.46 the 1.40 version was still somehow running....we uninstalled everything and then installed 1.46...then we updated the firmware and that made all the difference.
|
| Thu Dec 04, 2008 6:04 pm |
|
|
|
Page 1 of 1
|
[ 6 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 3 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
|
|