Go to Post I got something totally different from my FIRST experience. to me the spirit of FIRST is all about sharing. during the 6 week build period, you share yourself with the other people on your team. at the competition, you share your creation with everyone who watches your 'bot play the game. - George1902 [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 02-02-2003, 20:01
CHSguard72 CHSguard72 is offline
Registered User
#0612
 
Join Date: Jan 2003
Location: Chantilly, VA
Posts: 14
CHSguard72 is an unknown quantity at this point
Send a message via AIM to CHSguard72
Question NOT condition in PBASIC?

In C++ there is a condition, AND NOT which uses the syntax "!".
An example of this is: variable!=2

is there any ! command in PBASIC? If not, what syntax would I use to say "IF lightSensor1 DOES NOT EQUAL 1 THEN..."

thanks
  #2   Spotlight this post!  
Unread 02-02-2003, 20:04
Raven_Writer's Avatar
Raven_Writer Raven_Writer is offline
2004 Detroit & Pittsburgh Winners
AKA: Eric Hansen
FRC #0005 (RoboCards)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2002
Location: Melvindale
Posts: 1,549
Raven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really nice
Send a message via ICQ to Raven_Writer Send a message via AIM to Raven_Writer Send a message via MSN to Raven_Writer Send a message via Yahoo to Raven_Writer
Re: NOT condition in PBASIC?

Quote:
Originally posted by CHSguard72
In C++ there is a condition, AND NOT which uses the syntax "!".
An example of this is: variable!=2

is there any ! command in PBASIC? If not, what syntax would I use to say "IF lightSensor1 DOES NOT EQUAL 1 THEN..."

thanks
IF lighSensor1 ~= 1 THEN ...
__________________
AIM: wisprmylastbreth
EMail: nightskywriter@gmail.com
Y!: synsoflife

"ai yoru ga" -- "Love the nights"
  #3   Spotlight this post!  
Unread 02-02-2003, 20:09
CHSguard72 CHSguard72 is offline
Registered User
#0612
 
Join Date: Jan 2003
Location: Chantilly, VA
Posts: 14
CHSguard72 is an unknown quantity at this point
Send a message via AIM to CHSguard72
Can you use the ~= between 2 variables? Where I need this, i need to say "rc_sw15~=lightOn_prev" where lightOn_prev is either a 1 or a 0. This gives me an error, saying "expected a binary operator or ")"". Can i not use this syntax between 2 varialbes or only a variable and a constant?
  #4   Spotlight this post!  
Unread 02-02-2003, 20:12
Raven_Writer's Avatar
Raven_Writer Raven_Writer is offline
2004 Detroit & Pittsburgh Winners
AKA: Eric Hansen
FRC #0005 (RoboCards)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2002
Location: Melvindale
Posts: 1,549
Raven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really nice
Send a message via ICQ to Raven_Writer Send a message via AIM to Raven_Writer Send a message via MSN to Raven_Writer Send a message via Yahoo to Raven_Writer
Quote:
Originally posted by CHSguard72
Can you use the ~= between 2 variables? Where I need this, i need to say "rc_sw15~=lightOn_prev" where lightOn_prev is either a 1 or a 0. This gives me an error, saying "expected a binary operator or ")"". Can i not use this syntax between 2 varialbes or only a variable and a constant?
I'm not exactly sure. I just know that '~' is the PBASIC symbol for IS NOT.
__________________
AIM: wisprmylastbreth
EMail: nightskywriter@gmail.com
Y!: synsoflife

"ai yoru ga" -- "Love the nights"
  #5   Spotlight this post!  
Unread 02-02-2003, 20:58
K. Skontrianos's Avatar
K. Skontrianos K. Skontrianos is offline
Registered User
FRC #0102 (Dexterous Gearheads)
Team Role: Alumni
 
Join Date: Nov 2001
Rookie Year: 2000
Location: Somerville, NJ
Posts: 100
K. Skontrianos is an unknown quantity at this point
Trust me when I tell you that the not symbol in BASIC is simply the word 'NOT', at least when it is at the beginning of a statement. We have fallen into the habit of writing our code to emulate C++ style if statements by using the not command:

if NOT (condition) THEN SkipifA
statement
SkipifA:

I know the new compiler uses C++ style if commands, but we decided not switch to a beta version. We just don't trust it enough.
__________________
www.team102.com
2000 National Finalists
2003 J&J Mid-Atlantic Regional Winners
2003 BattleCry Best Autonomous
  #6   Spotlight this post!  
Unread 02-02-2003, 21:01
rbayer's Avatar Unsung FIRST Hero
Happy Birthday! rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
<> is the same as C/C++'s !=. For example:

if p1_y <> 127 then doStuff
is the same as
if NOT (p1_y=127) then doStuff
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
  #7   Spotlight this post!  
Unread 02-02-2003, 22:05
rwaliany's Avatar
rwaliany rwaliany is offline
R
None #0691 (HartBurn)
Team Role: Programmer
 
Join Date: Jan 2003
Rookie Year: 2000
Location: http://www.hartrobot.com
Posts: 137
rwaliany will become famous soon enough
Quote:
Originally posted by CHSguard72
Can you use the ~= between 2 variables? Where I need this, i need to say "rc_sw15~=lightOn_prev" where lightOn_prev is either a 1 or a 0. This gives me an error, saying "expected a binary operator or ")"". Can i not use this syntax between 2 varialbes or only a variable and a constant?
No, we tried it yesterday.

Instead we do for bits

plow_state = ~plow_state <- that works
__________________
R
  #8   Spotlight this post!  
Unread 03-02-2003, 17:42
Greg's Avatar
Greg Greg is offline
Registered User
FRC #1075 (Sinclair Sprockets)
Team Role: College Student
 
Join Date: Nov 2002
Rookie Year: 2003
Location: Whitby, Ontario, Canada
Posts: 108
Greg is on a distinguished road
Send a message via ICQ to Greg Send a message via MSN to Greg
Quote:
Originally posted by rwaliany
No, we tried it yesterday.

Instead we do for bits

plow_state = ~plow_state <- that works
Plowstate? Looks surprisingly like my piece of code I think most bots are going to be similar.
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
Obscure PBASIC for RoboEmu rbayer Programming 1 28-03-2003 23:57
PBasic 2.5 vs. 2.0 Anthony Kesich Programming 6 09-02-2003 22:06
The New PBASIC rbayer Programming 10 07-01-2003 21:02
Output voltage in PBASIC diego25 Programming 7 31-01-2002 22:50
Another PBASIC Question Ian W. Programming 4 31-01-2002 21:36


All times are GMT -5. The time now is 03:10.

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