wall detection (touch) % wall detection(ultra sonic)
Author |
Message |
MariosRobot
Novice
Joined: Wed Feb 20, 2013 2:46 am Posts: 64
|
 wall detection (touch) % wall detection(ultra sonic)
i have problem in two programs with wall detections(touch) and wall detections(ultra sonic)
the while loop not take the function that go forward, someone knows why?
1st program const tSensors touchSensor = (tSensors) S1;//sensor touch task main() { while(SensorValue(touchSensor) == 0) //go forware { motor[motorA]=10; motor[motorC]=10; wait1Msec(4550); } //go backward motor[motorA]=-3; motor[motorC]=-3; wait1Msec(4550);
2nd program const tSensors bumper = (tSensors) S1;//sensor touch task main() { while(SensorValue(bumper) == 0) //go forware { motor[motorA]=10; motor[motorC]=10; wait1Msec(4550); } //go backward motor[motorA]=-3; motor[motorC]=-3; wait1Msec(4550);
|
Wed Apr 17, 2013 7:02 am |
|
 |
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 630 Location: If I told you, I'd have to kill you.
|
 Re: wall detection (touch) % wall detection(ultra sonic)
What version of RobotC are you using? And could you please use the [code][/code] tags for your code? It makes it easier to read and understand.
_________________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.
|
Wed Apr 17, 2013 10:28 am |
|
 |
MariosRobot
Novice
Joined: Wed Feb 20, 2013 2:46 am Posts: 64
|
 Re: wall detection (touch) % wall detection(ultra sonic)
i use the latest version 3.6
|
Wed Apr 17, 2013 3:27 pm |
|
 |
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 630 Location: If I told you, I'd have to kill you.
|
 Re: wall detection (touch) % wall detection(ultra sonic)
Ok well, I just took your code and indented it all myself. Several things stand out. 1. You don't have a closing brace for your task main() 2. You're not defining the S1 sensor type. 3. And I have no idea what you're trying to accomplish with "const tSensors touchSensor = (tSensors) S1;//sensor touch". Try this code, it should work fine. and, FYI, these two programs are identical, they just have different names for the sensor. Also just wondering, why are your motor speeds so slow?
_________________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.
|
Wed Apr 17, 2013 3:52 pm |
|
 |
MariosRobot
Novice
Joined: Wed Feb 20, 2013 2:46 am Posts: 64
|
 Re: wall detection (touch) % wall detection(ultra sonic)
thanks a lot bro, i try again with these codes, i test the robot's sensor because i have a project in robotC but my area it is small for this reason i put lower speed, to control easy the robot
|
Thu Apr 18, 2013 7:08 am |
|
 |
MariosRobot
Novice
Joined: Wed Feb 20, 2013 2:46 am Posts: 64
|
 Re: wall detection (touch) % wall detection(ultra sonic)
i try with this code but the while loop not working, when the Lego touch in the wall not go back, how to check if the Lego's sensor working?
|
Thu Apr 18, 2013 8:02 am |
|
 |
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 630 Location: If I told you, I'd have to kill you.
|
 Re: wall detection (touch) % wall detection(ultra sonic)
Ok, so you want it to go forwards until it hits the wall? If so, then try this: I have commented out the wait time in the while loop, because if you do have it waiting it will only check the touch sensor every 4.55 seconds. That's bad. You also might get better results with some faster motor speeds. Even 25% would be good.
_________________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.
|
Thu Apr 18, 2013 10:23 am |
|
 |
MariosRobot
Novice
Joined: Wed Feb 20, 2013 2:46 am Posts: 64
|
 Re: wall detection (touch) % wall detection(ultra sonic)
thanks again bro, i try again with this code
|
Fri Apr 19, 2013 7:09 am |
|
 |
MariosRobot
Novice
Joined: Wed Feb 20, 2013 2:46 am Posts: 64
|
 Re: wall detection (touch) % wall detection(ultra sonic)
again not working bro, how to check if the robot's sensor it working great?
|
Sat Apr 20, 2013 4:18 am |
|
 |
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 630 Location: If I told you, I'd have to kill you.
|
 Re: wall detection (touch) % wall detection(ultra sonic)
Go to the "view" menu, and select touch sensor. That'll tell you if it's working or not.
_________________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.
|
Sat Apr 20, 2013 11:07 am |
|
 |
MariosRobot
Novice
Joined: Wed Feb 20, 2013 2:46 am Posts: 64
|
 Re: wall detection (touch) % wall detection(ultra sonic)
thanks a lot bro
|
Sun Apr 21, 2013 3:21 am |
|
 |
MariosRobot
Novice
Joined: Wed Feb 20, 2013 2:46 am Posts: 64
|
 Re: wall detection (touch) % wall detection(ultra sonic)
i not found the touch sensor in "view" menu i uploaded the print screen
|
Sun Apr 21, 2013 3:59 am |
|
 |
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 630 Location: If I told you, I'd have to kill you.
|
 Re: wall detection (touch) % wall detection(ultra sonic)
No, no, on the NXT. You scroll through it's menu screen until you see "View".
_________________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.
|
Sun Apr 21, 2013 9:27 am |
|
 |
Coder A
Moderator
Joined: Thu Jan 03, 2013 5:10 pm Posts: 207 Location: The plateau north of the Ohio River Valley, also known as Cave Country.
|
 Re: wall detection (touch) % wall detection(ultra sonic)
That's where my friends apostrophe went! Sorry, I couldn't resist. If you look one my profile on of my interests is correct grammar.
_________________ I'm not a robot! I'm british! ~ quote from an asparagus I am not a robot! I am a unicorn! ~ quote from a robot
Last edited by Coder A on Tue Apr 23, 2013 2:12 pm, edited 1 time in total.
|
Sun Apr 21, 2013 7:37 pm |
|
 |
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 630 Location: If I told you, I'd have to kill you.
|
 Re: wall detection (touch) % wall detection(ultra sonic)
No, no, I, am like, way, way, correct.  We unfortunate Americans say "No, no" when we correct someone. 
_________________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.
|
Sun Apr 21, 2013 7:43 pm |
|
|
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
|
|