View unanswered posts | View active topics It is currently Thu Oct 18, 2018 11:48 am






Reply to topic  [ 2 posts ] 
Gyro always showing positive values. 
Author Message
Rookie

Joined: Tue Aug 19, 2014 12:15 pm
Posts: 37
Post Gyro always showing positive values.
The manual tells me that the gyro default value is -3600(counter clockwise) to 3600 (clockwise).

The sensor value is only going from 0 to +3600 as far as I can tell.

My code is as followers
#pragma config(Sensor, in1, lfRght, sensorLineFollower)
#pragma config(Sensor, in2, lfCtr, sensorLineFollower)
#pragma config(Sensor, in3, lfLft, sensorLineFollower)
#pragma config(Sensor, in4, armPot, sensorPotentiometer)
#pragma config(Sensor, in5, gyrO, sensorGyro)
#pragma config(Sensor, in6, lghtSen, sensorReflection)
#pragma config(Sensor, dgtl1, ultSon, sensorSONAR_cm)
#pragma config(Sensor, dgtl8, armLLSw, sensorTouch)
#pragma config(Sensor, dgtl12, Bmpr, sensorTouch)
#pragma config(Motor, port1, rghtMtr, tmotorVex393_HBridge, openLoop)
#pragma config(Motor, port10, lftMtr, tmotorVex393_HBridge, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

#pragma DebuggerWindows("Motors")
#pragma DebuggerWindows("Sensors")

task main()
{
wait1Msec(1000);
SensorValue[gyrO] = 0;
wait1Msec(2000); //give gyro time to urn up

while(true)
{
if (SensorValue[gyrO] < 0)
{ //truning left counter clockwise
motor[lftMtr] = -45;
motor[rghtMtr] = 45;
wait1Msec(250);
}
}
wait1Msec(250);
motor[lftMtr] = 0;
motor[rghtMtr] = 0;
}


Thu Jul 23, 2015 11:11 am
Profile
Rookie

Joined: Tue Aug 19, 2014 12:15 pm
Posts: 37
Post Re: Gyro always showing positive values.
Changed program. Gyro still only showing positive values.
long degrees = 850;
task main()
{
wait1Msec(1000);
SensorValue[gyrO] = 0;
wait1Msec(2000); //give gyro time to urn up
SensorFullCount[gyrO] = 3600;

while(SensorValue[gyrO] < degrees)
{
//truning left counter clockwise
motor[lftMtr] = -35;
motor[rghtMtr] = 35;
wait1Msec(250);
}
wait1Msec(250);
motor[lftMtr] = 0;
motor[rghtMtr] = 0;
}

This code should replace the prior code.


Thu Jul 23, 2015 2:40 pm
Profile
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.