View unanswered posts | View active topics It is currently Fri Oct 31, 2014 11:03 am






Reply to topic  [ 3 posts ] 
programming sensorType without using motor and sensor setup 
Author Message
Rookie

Joined: Tue Aug 14, 2007 1:38 pm
Posts: 16
Post programming sensorType without using motor and sensor setup
I am learning as I go, but I'm trying to have my students learn to program as much as possible on their on. I would like to learn and teach how to set up the sensors and motors without using the motor and sensor setup, so they understand arrays and variables a little. I was able to work some with the NXTs but am stumped on how to do sensors that require an input and an interupt.
An example of NXT I have figured out:
int speed = 40;
int motorB =2;
int LOUD = 1;

SensorType[0]=sensorSonar;
SensorType[Loud]=sensorSoundDB;
motor[motorB]=speed; //showing how motorB variable can be used to run C output


How do I set up a Quad Encoder if it has an input and an interupt?

Thanks for any help for this old novice


Fri Dec 11, 2009 5:49 pm
Profile
Creator
Creator

Joined: Fri Feb 09, 2007 9:21 am
Posts: 615
Post Re: programming sensorType without using motor and sensor setup
Use the "motors and sensor setup" to setup the configuration you want.

The use the "Disassembly" output to figure it out. "F9" is the shortcut key. It's on the menu "Robot -> View -> Disassembly". YOu may have to set to an advanced user level ("Robot -> Windows -> User Level -> xxxxx" to get the extra commands on the menu to see this.

Here's the output for the quad sensor.

Code:
#pragma config(Sensor, in9,    encoder,             sensorQuadEncoder, int3)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//
task main()
//
//Code segment: main(); Task: 0
//
0000: C74000                   StopAllMotors()                   
0003: 11184401                 bIFIAutonomousMode = 1             
0007: 11184B00                 nAnalogChannelCount = 0           
000B: 11184300                 bHasSoundDriver = 0               
000F: 11270802                 ifiInterruptPort[08] = 2           
0013: 110A080F                 SensorType[08] = 15               
{
}
0017: C74000                   StopAllMotors()                   
001A: F6                       Return()                            // main()


Tue Dec 15, 2009 7:33 am
Profile
Rookie

Joined: Tue Aug 14, 2007 1:38 pm
Posts: 16
Post Re: programming sensorType without using motor and sensor setup
Thanks!!


Tue Dec 15, 2009 4:29 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 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.