Go to Post All labor is donated by the webmaster "Brandon". - Mike Martus [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 23-01-2008, 23:07
mechman9113 mechman9113 is offline
Registered User
FRC #0393
 
Join Date: Oct 2006
Location: Greenfield, IN
Posts: 3
mechman9113 is an unknown quantity at this point
IR Sensor

Is there a default code for the IR Sensor?
If so, can anyone give me a link or point me in the right direction?
If not, can anyone help me out with programming it? Me and my programming partners are new to the programming team so we hardly know anything about it.
__________________
Team 393 Full Metal Jackets... FMJ for life.
  #2   Spotlight this post!  
Unread 23-01-2008, 23:21
wt200999's Avatar
wt200999 wt200999 is offline
Texas Instruments
AKA: Will Toth
FRC #3005 (Robochargers)
Team Role: Mentor
 
Join Date: Mar 2006
Rookie Year: 2004
Location: Dallas, Texas
Posts: 325
wt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud of
Send a message via MSN to wt200999
Re: IR Sensor

Are you using MPLab?

Do you have it wired up correctly? It should end up going into 4 different digital ports. It sends a signal of 1 to them. Do you have it blinking the lights? There is a guide somewhere on here that tells how to do all of that. If you want I can send you the code I wrote for it as an example. I will try and find the link on here

Edit: Here is the link for the user guide for the sensor if you need that:

http://www.usfirst.org/uploadedFiles...%20_121007.pdf

Last edited by wt200999 : 23-01-2008 at 23:27.
  #3   Spotlight this post!  
Unread 23-01-2008, 23:51
Chaos in a Can Chaos in a Can is offline
Joel Spadin
FRC #1736 (Robot Casserole)
Team Role: Programmer
 
Join Date: Mar 2007
Rookie Year: 2007
Location: Peoria, IL
Posts: 58
Chaos in a Can is an unknown quantity at this point
Send a message via MSN to Chaos in a Can
Re: IR Sensor

There is no default code for the sensor, but if you wire the four outputs on the IR board to four of the digital i/o pins, you can easily read the values it sends.

Include ifi_aliases.h and use the names it gives you for the digital inputs.
If you wired the board to the inputs 3-6, your code might look something like this:

Code:
#include "ifi_aliases.h"
char IR_in1 = rc_dig_in03;
char IR_in2 = rc_dig_in04;
char IR_in3 = rc_dig_in05;
char IR_in4 = rc_dig_in06;
__________________
2006 Xerox Creativity Award
2007 General Motors Industrial Design Award
2008 Judges' Award
2009 Chrysler Team Spirit Award

  #4   Spotlight this post!  
Unread 24-01-2008, 18:25
Steve Dobler's Avatar
Steve Dobler Steve Dobler is offline
Mentor - PJHS Team 1302
FRC #1302 (PoJo)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2005
Location: Pope John High School, Sparta NJ
Posts: 1
Steve Dobler is an unknown quantity at this point
Re: IR Sensor

How do you deal with the fact that the inputs are being pulsed on and off at around every 100ms? How does the program keep from repeating multiple times?
__________________
Steve Dobler
BAE Systems
Mentor - Team 1302
Pope John High School, Sparta NJ
  #5   Spotlight this post!  
Unread 24-01-2008, 18:46
jgannon's Avatar
jgannon jgannon is offline
I ᐸ3 Robots
AKA: Joey Gannon
no team
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Pittsburgh, PA
Posts: 1,467
jgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond repute
Re: IR Sensor

Quote:
Originally Posted by Steve Dobler View Post
How do you deal with the fact that the inputs are being pulsed on and off at around every 100ms? How does the program keep from repeating multiple times?
You may be interested in reading up on "switch debouncing".
__________________
Team 1743 - The Short Circuits
2010 Pittsburgh Excellence in Design & Team Spirit Awards
2009 Pittsburgh Regional Champions (thanks to 222 and 1218)
2007 Pittsburgh Website Award
2006 Pittsburgh Regional Champions (thanks to 395 and 1038)
2006 Pittsburgh Rookie Inspiration & Highest Rookie Seed

Team 1388 - Eagle Robotics
2005 Sacramento Engineering Inspiration
2004 Curie Division Champions (thanks to 1038 and 175)
2004 Sacramento Rookie All-Star

_
  #6   Spotlight this post!  
Unread 24-01-2008, 19:34
wt200999's Avatar
wt200999 wt200999 is offline
Texas Instruments
AKA: Will Toth
FRC #3005 (Robochargers)
Team Role: Mentor
 
Join Date: Mar 2006
Rookie Year: 2004
Location: Dallas, Texas
Posts: 325
wt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud of
Send a message via MSN to wt200999
Re: IR Sensor

instead of having it do the actual actions when you press the button you can have it set a variable with the button, then it does a certain routine depending on the button pressed. Example:

Code:
unsigned char test;

if(rc_dig_in01)
    test=1;

if(rc_dig_in02)
    test=2;

if(rc_dig_in03)
    test=3;

if(rc_dig_in04)
    test=4;


if(test==1)
   (routine a)

etc
  #7   Spotlight this post!  
Unread 28-01-2008, 20:13
mechman9113 mechman9113 is offline
Registered User
FRC #0393
 
Join Date: Oct 2006
Location: Greenfield, IN
Posts: 3
mechman9113 is an unknown quantity at this point
Re: IR Sensor

We haven't actually done anything with the physical IR Sensor, it's just me and my programming partner are new to C and we need some tips on how to program it. We do have mplab.

Also if anyone can help with the yrg, the daa, and the gts, we would greatly appreciate it.
__________________
Team 393 Full Metal Jackets... FMJ for life.
  #8   Spotlight this post!  
Unread 29-01-2008, 00:14
AdmiralAllen's Avatar
AdmiralAllen AdmiralAllen is offline
Master of Computers and Robots
AKA: Allen Worcester
FRC #1662 (Raptor Force Engineering)
Team Role: Alumni
 
Join Date: May 2006
Rookie Year: 2005
Location: California
Posts: 37
AdmiralAllen will become famous soon enough
Re: IR Sensor

Quote:
Originally Posted by wt200999 View Post
instead of having it do the actual actions when you press the button you can have it set a variable with the button, then it does a certain routine depending on the button pressed. Example:

Code:
unsigned char test;

if(rc_dig_in01)
    test=1;

if(rc_dig_in02)
    test=2;

if(rc_dig_in03)
    test=3;

if(rc_dig_in04)
    test=4;


if(test==1)
   (routine a)

etc
is that code adequte to adjust the variable "test"
  #9   Spotlight this post!  
Unread 29-01-2008, 14:52
marccenter's Avatar
marccenter marccenter is offline
Registered User
FRC #3548 (RoboRavens2)
Team Role: Coach
 
Join Date: Sep 2004
Rookie Year: 2004
Location: Royal Oak
Posts: 406
marccenter has a spectacular aura aboutmarccenter has a spectacular aura about
Re: IR Sensor - Create 100 ms timer loop

Quote:
Originally Posted by Steve Dobler View Post
How do you deal with the fact that the inputs are being pulsed on and off at around every 100ms? How does the program keep from repeating multiple times?
One method is to create a timer loop that runs every 100 msec that read's all four switches and saves the status. So, after 100 msec, the first thing inside the loop is to reset the timer to 0 and start again. Next, all four inputs are read and saved. 100 msec timer loop ends. Last, this routine can then be called whenever you want to determine the IR.
As long as 100 msec has expired since the last time you ran the loop, it should begin immediately.
__________________
Marc Center
FIRST FRC Mentor/Coach - Team 3548 Royal Oak RoboRavens#2 - on Sabbatical 2017 season
marc.center@gmail.com
Mobile: 248-255-7377

Last edited by marccenter : 29-01-2008 at 14:52. Reason: Clean up
  #10   Spotlight this post!  
Unread 29-01-2008, 16:18
whlspacedude's Avatar
whlspacedude whlspacedude is offline
Registered User
AKA: Will
FRC #1529 (Cyber Cards)
Team Role: Alumni
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Indianapolis,Indiana 46227
Posts: 167
whlspacedude is just really nicewhlspacedude is just really nicewhlspacedude is just really nicewhlspacedude is just really nice
Send a message via AIM to whlspacedude Send a message via MSN to whlspacedude Send a message via Yahoo to whlspacedude
Re: IR Sensor

here is a link to a copy of the code we wrote in easyc to test our ir board

each button on the remote should turn a different light on the operator interface on for 1 sec and then turn it back off.

hope this helps

http://whlspacedude.googlepages.com/IRBOARD.zip

also make sure you have the ir board hooked up right

here is some good info on hooking it up

http://www.chiefdelphi.com/forums/sh...26&postcount=5
__________________
Some people are like slinkies they are only good for 1 thing... pushing them down flights of stairs

1529 mph = 4 109 952 furlongs per fortnight
Closed Thread


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
IR Sensor fabalafae Programming 1 19-01-2008 16:53
Sensor Molten Programming 3 17-02-2007 17:43
Sensor or no Sensor For Autonomous mode Kyle1010 Programming 14 22-01-2003 13:10
Sensor Q Brew Technical Discussion 2 10-02-2002 12:48
Sensor Oakridege_665 Technical Discussion 5 10-01-2002 16:53


All times are GMT -5. The time now is 18:34.

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