Go to Post This will likely fall on deaf eyes but - - JaneYoung [more]
Home
Go Back   Chief Delphi > Other > FIRST Tech Challenge
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 21-01-2014, 08:09
Mr. 1033's Avatar
Mr. 1033 Mr. 1033 is offline
Registered User
AKA: Paul E. Lathrop
FRC #1033 (Team CLUTCH)
Team Role: Coach
 
Join Date: Jun 2012
Rookie Year: 2003
Location: United States
Posts: 40
Mr. 1033 is a jewel in the roughMr. 1033 is a jewel in the roughMr. 1033 is a jewel in the roughMr. 1033 is a jewel in the rough
[FTC]: FTC Multiplexer

Has anyone programmed the Multiplexer with robotc?

We have been working on it and found the following resource:

http://www.robotshop.com/media/files...st-nsx2020.pdf

We were kind of hoping it was a little simpler.

Anyone know of any other way to use it?

Thanks!
Reply With Quote
  #2   Spotlight this post!  
Unread 21-01-2014, 14:41
Sasha Sasha is offline
Registered User
AKA: Alexander Kirillov
FTC #4137 (IslandBots)
Team Role: Coach
 
Join Date: Sep 2010
Rookie Year: 2008
Location: Long Island, NY
Posts: 58
Sasha is just really niceSasha is just really niceSasha is just really niceSasha is just really niceSasha is just really nice
Re: [FTC]: FTC Multiplexer

Yes, we are using the sensor multiplexor, using the 3rd party driver suite
Here is the appropriate part of our autonomous program. Hope it helps.

Code:
#pragma config(Hubs,  S2, HTMotor,  HTServo,  HTMotor,  none)
#pragma config(Sensor, S1,     HTSMUX,              sensorI2CCustom)
#pragma config(Sensor, S3,     IRsensor,       sensorI2CCustom)
#pragma config(Sensor, S4,     GyroSensor,     sensorI2CHiTechnicGyro)
#pragma config(Motor,  motorA,          BlockDrop,     tmotorNXT, PIDControl, encoder)
#pragma config(Motor,  mtr_S2_C1_1,     winch,         tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S2_C1_2,     right,         tmotorTetrix, openLoop, encoder)
#pragma config(Motor,  mtr_S2_C3_1,     arm,           tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S2_C3_2,     left,          tmotorTetrix, openLoop, reversed)
#pragma config(Servo,  srvo_S2_C2_1,    servo1,               tServoNone)
#pragma config(Servo,  srvo_S2_C2_2,    servo2,               tServoNone)
#pragma config(Servo,  srvo_S2_C2_3,    servo3,               tServoNone)
#pragma config(Servo,  srvo_S2_C2_4,    servo4,               tServoNone)
#pragma config(Servo,  srvo_S2_C2_5,    servo5,               tServoNone)
#pragma config(Servo,  srvo_S2_C2_6,    grabber,              tServoStandard)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#include "drivers/hitechnic-gyro.h"
#include "drivers/hitechnic-irseeker-v2.h"
#include "drivers/hitechnic-sensormux.h"
#include "drivers/lego-light.h"
#include "JoystickDriver.c"
const tMUXSensor LightSensorLeft = msensor_S1_1;
const tMUXSensor LightSensorRight = msensor_S1_4;

/////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  Global variables
//
/////////////////////////////////////////////////////////////////////////////////////////////////////
int initialLightLeft, initialLightRight;

/////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  Checks whether light sensor sees white line
//
/////////////////////////////////////////////////////////////////////////////////////////////////////



bool LeftOnBlack(){ //returns true if left light sensor is on black
  return (LSvalNorm(LightSensorLeft) <= 10 + initialLightLeft);
}

bool RightOnBlack(){ //returns true if right light sensor is on black
  return (LSvalNorm(LightSensorRight) <= 10 + initialLightRight);
}

/////////////////////////////////////////////////////////////////////////////////////////////////////
//
//                                    initializeRobot
/////////////////////////////////////////////////////////////////////////////////////////////////////

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.
  LSsetActive(LightSensorLeft);//turn on the light
  LSsetActive(LightSensorRight);//turn on the light
  initialLightLeft=LSvalNorm(LightSensorLeft);
  initialLightRight=LSvalNorm(LightSensorRight);
  return;
}


/////////////////////////////////////////////////////////////////////////////////////////////////////
//
//                                         Main Task
//
/////////////////////////////////////////////////////////////////////////////////////////////////////


task main()
{
  initializeRobot();
  StartTask(printStuff);
  waitForStart(); // Wait for the beginning of autonomous phase.
  
  motor[right]=30;motor[left]=30;
  //wait until one of the sensors sees white
  while (LeftOnBlack() && RightOnBlack() ) {
   wait1Msec(1);
  }
  motor[right]=0;motor[left]=0;
  PlaySound(soundBeepBeep);
  wait10Msec(50);
}
Reply With Quote
  #3   Spotlight this post!  
Unread 26-01-2014, 02:55
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 672
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: [FTC]: FTC Multiplexer

Our team also uses the HiTechnics Sensor MUX. In fact, we use two of them. Our robot is fully loaded with sensors (8 in total). We actually wish to add one more but ran out of ports, the other two sensor ports are for the motor chains.
__________________
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 12:44.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi