Go to Post If you think life is fair, you are sadly mistaken. - R.C. [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 27-01-2004, 18:44
Code\\Pilot Code\\Pilot is offline
< Only smart people see my avatar
AKA: Rafael Estrada
FRC #1065 (Tatsu)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Florida
Posts: 53
Code\\Pilot is an unknown quantity at this point
Send a message via AIM to Code\\Pilot Send a message via MSN to Code\\Pilot
Question how do i tell to the edurc when the remote is on.

I have created an autonomous mode, I pasted it in the user_routines.c, in the part that says /*add your code here*/, well, it works.
Now i want to find a way to initialize it only when my remote control is off, and stop it when is on.
I tried:
if (PWM_n1 = PWM_n2 = 0) /*where the pwm_n# is the alias given to the*/
{ the whole rutine /* remote inputs */
}
but that does not make it work.
Is there a way i can tell the robot to initialize it when the remote is off?
i will be glad if anybody can help me.
Thanks
Code\\monkey.
  #2   Spotlight this post!  
Unread 27-01-2004, 20:20
Greg Ross's Avatar
Greg Ross Greg Ross is offline
Grammar Curmudgeon
AKA: gwross
FRC #0330 (Beach 'Bots)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Hermosa Beach, CA
Posts: 2,245
Greg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond repute
Send a message via AIM to Greg Ross Send a message via Yahoo to Greg Ross
Re: how do i tell to the edurc when the remote is on.

"if (PWM_n1 = PWM_n2 = 0)" is not what you want. That says "set PWM_n2 equal to zero, and then set PWM_n1 equal to PWM_n2". (Actually, it sets PWM_n1 equal to the value of the expression "PWM_n2 = 0" which happens to be the value assigned to PWM_n2.) The value of the expression "(PWM_n1 = PWM_n2 = 0)" is zero (which is false, by definition), so the next statement will never get executed.

I guess what you want is "if (PWM_n1 == 0 && PWM_n2 == 0)"

P.S.
you might be tempted to try "if (PWM_n1 == PWM_n2 == 0)" which is incorrect also. This is going to compare PWM_n1 with the boolean expression "PWM_n2 == 0", so your conditional statement will be executed only if PWM_n2 is zero and PWM_n1 is 1 (or whatever value the C18 compiler uses for "true") or if PWM_n2 is non-zero and PWM_n1 is zero.
__________________
Greg Ross (The Grammar Curmudgeon formerly known as gwross)
S/W Engineer, Team 330, the Beach 'Bots
<--The Grammar Curmudgeon loves this cartoon.
“Life should not be a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming "Wow! What a Ride!" Hunter S. Thompson
"Playing a practical joke means doing something mean and calling it funny." Me

Last edited by Greg Ross : 27-01-2004 at 20:32. Reason: Added P.S.
  #3   Spotlight this post!  
Unread 28-01-2004, 11:04
Kyokuzen Kyokuzen is offline
Registered User
#0148 (Robowranglers)
 
Join Date: Oct 2003
Location: Greenville, TX
Posts: 1
Kyokuzen is an unknown quantity at this point
Re: how do i tell to the edurc when the remote is on.

If the remote is off, or there is no receiver plugged into the EDU RC, all PWM in values will be 127.

If you are getting all 127s, you can't really tell if there is no PWM input, or if your remote is on but everything is perfectly centered. But perhaps you could trim your remote slightly off center, but still within the deadband (128 or 129, for example) and program your RC so that it knows that perfect 127s represent transmitter off, but that anything else represents transmitter on.
  #4   Spotlight this post!  
Unread 28-01-2004, 12:20
deltacoder1020's Avatar
deltacoder1020 deltacoder1020 is offline
Computer Guy
AKA: Dav
#1020 (The Indiana Prank Monkeys)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Muncie, Indiana
Posts: 340
deltacoder1020 has a spectacular aura aboutdeltacoder1020 has a spectacular aura about
Send a message via AIM to deltacoder1020
Re: how do i tell to the edurc when the remote is on.

on the other hand, the chances that all of the PWMs will be dead-centered is fairly slim, so if every single one is reading as 127, you could probably assume the controller isn't plugged in/on.
__________________
Team 1020, the Indiana Prank Monkeys (www.team1020.org)
  #5   Spotlight this post!  
Unread 28-01-2004, 21:00
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: how do i tell to the edurc when the remote is on.

If the controller is cheap (low res: 3 posible values per stick). Of course, if your paying $130, probably not.
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
Qotw [11-17-02]: Manchester or remote kickoff... Ken Leung Rumor Mill 19 09-01-2004 16:18
Remote Remote Kick off at University High School George1902 Off-Season Events 4 04-01-2004 21:05
Rochester Remote Kickoff Matt Leese General Forum 1 23-10-2003 08:39
FIRST Remote Kickoff is coming... Rich Wong General Forum 13 20-08-2003 00:00
Philadelphia Alliance Remote Kicoff... purplehaze357 General Forum 6 22-12-2002 15:48


All times are GMT -5. The time now is 09: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