| | |
need university help first year
Please support our Legacy and Other Languages advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Aug 2009
Posts: 7
Reputation:
Solved Threads: 0
hey this is umar here and i really needed some help because i have my exam tommorow. i was assigned to make a robot. ad to program it as some of may you know( i hope) the NXC language (i think its called that) to program the Mindstorms nxt brick. if some can help me i only have limited knowledge, i need to make this robot stay away from this color yellow and stay in black , i will be given a a small rink or arean painted black (as big as a air hockey table) and rest painted yellow. there will also be another robot that will try to catch my robot so i have to make my robot escape for about 90 secs. i have written some code if some of you can help that would be great.[description of my robot: its both sensors are on the front( light sensor facing ab to the ground and the distance one facing straight forwarf) the two motors are on the front wheels and one tire on the back. and here is my code so far.
*Update: the tries thing i did doesnt seem to work.
#include "NXCDefs.h"
mutex moveMutex;
#define dist 60
#define extranear 10
int tries = 0;
inline void scan_front()
{
SetSensorLowspeed(IN_1);
if (SensorUS(IN_1) > dist)
{
OnFwd(OUT_AB, 75);
tries = 0;
}
if (SensorUS(IN_1) < dist){
Off(OUT_AB);
RotateMotor(OUT_A, 80, 300);
tries++;
}
if(SensorUS(IN_1) < extranear)
{
Off(OUT_AB);
RotateMotor(OUT_A, 80, 720);
}
if(tries >= 3 ){
Off(OUT_AB);
OnFwd(OUT_AB, 75);
}
}
task main()
{
while (true){
scan_front();
}
}*Update: the tries thing i did doesnt seem to work.
Last edited by umarmaqsood; Sep 25th, 2009 at 2:33 am.
You have got a good assignment .Do not mix 2 operation , first code "stay away" from other robot and then try to avoid color , there may be situtation like robot cannot avoid color to stay away from the other robot.
![]() |
Similar Threads
- Tell us about yourself (Community Introductions)
- Hi everyone! (Community Introductions)
- CIS or CS? (IT Professionals' Lounge)
- career change to CS (Computer Science)
- College?! (Geeks' Lounge)
- Just started C++. Problems with MS Visual C++ 2005 Express. (C++)
- List 5 random facts about yourself (Geeks' Lounge)
- AID for university (Geeks' Lounge)
- Alright, Computer Science major... take it or not? (IT Professionals' Lounge)
Other Threads in the Legacy and Other Languages Forum
- Previous Thread: Error when using a contraint in Access
- Next Thread: Re: permutation of a string
Views: 965 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for Legacy and Other Languages






