View unanswered posts | View active topics It is currently Sun Oct 26, 2014 5:45 am






Reply to topic  [ 2 posts ] 
checking once with sensor 
Author Message
Rookie

Joined: Sat Nov 17, 2012 10:27 pm
Posts: 5
Post checking once with sensor
Hi, it's me again, and I need help with a new problem. I need a sensor to only check once, when the program starts; and if it's a certain value, it does something specific for that value. The sensor is an IR sensor.
Thanks,
Lincoln


Thu Jan 10, 2013 11:55 pm
Profile
Senior Roboticist
User avatar

Joined: Wed Sep 28, 2011 10:13 pm
Posts: 630
Location: If I told you, I'd have to kill you.
Post Re: checking once with sensor
Psuedo-code!
Code:
task main()
{
   if(sensor reading == sensor target)
   {
       do stuff
   }
   else
   {
       do other stuff
   }
}
If you want it to do the "else" after it does the "if", then don't put the other stuff in an else.

_________________
A.K.A. inxt-generation
Self-proclaimed genius, and future world dominator.
My Brickshelf Folder
"Don't they teach recreational mathematics anymore?" - The Tenth Doctor
Bow down to Nikola Tesla, King of the Geek Gods.


Fri Jan 11, 2013 12:16 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 2 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.