Help on programming...

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Help on programming...

336 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by raghavendrabsrg on Tue Nov 01 05:44:54 MST 2011
Hi, Im a beginner in LPC and desperately need your help guys.

I've to make a simple robot for a competition (with NO prize money), deadline is 3days.

Now I've written a simple algorithm of how the bot works, And its running pretty with an AVR 128(atmel).

But im not able to startup good with LPCxpresso 1114/302...

So i actually needed some real code that works.. if you can help, i'd be greatful to you...

Algorithm -
Objective: The robot must find its enemy bot, and then push the enemy bot out of the arena which is a circle of black line.
To find black line and to be inside the circle i've used line sensors.
To find the enemy bot i've used a obstacle sensor.

S1 is a left side line sensor.
s2 is a right side line sensor.
A1 is a obstacle sensor at front of the bot.

//program begins

#includes ??

main()   // main program begins
{

while(1)   // let the main program run forever in the MCU.
{

If((s1||s2) == 0)  // bot is inside the circle, so search the target.
{
Searchmode();
}

If(s1 == 1)  // line detected, so turn back into the circle, and search again.
{
turn right for 0.5 seconds;
go front for 1 second;
searchmode();
}

If(s2 == 1)  // line detected, so turn back into the circle, and search again.
{
turn left for 0.5 seconds;
go front for 1 second;
searchmode();
}

}  // end while.

}  // end Main.

Searchmode()  // begin search sub program. 
{
Rotate bot, searching for a signal in obstacle sensor - for 3 seconds;
If (A1 == 1)  // bot found!, so stop, and move towards the bot and push it.
{
stop;
move forward;
}
else  // bot escaped, so move forward and search again.
Move forward 1 second and again search mode();
}
// End of everything.

And i know this is not fair to ask the actual code, but i was not satisfied with the stuff i found in the 'examples' given.. so need to get familiarized with those GPIOSetValue(para) and other basic stuff..

thanks in advance. :)
0 Kudos
6 Replies

329 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by vasanth on Thu Nov 03 22:09:35 MST 2011

Quote:
but i was not satisfied with the stuff i found in the 'examples' given



We all satisfied... :confused:


Quote:
im afraid i'd never start with it



Hope you spend sometime with LPC...Xpresso..:)
0 Kudos

329 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ToBeFrank on Wed Nov 02 13:20:50 MST 2011

Quote: raghavendrabsrg
Can you provide me with the code?



No.


Quote: raghavendrabsrg
other wise i guess ill have to study through the whole documentation (which is not so good when compared to AVR's, but i really like the features in lpc) and hopefully write the code by myself..



This is your best plan.
0 Kudos

329 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by raghavendrabsrg on Wed Nov 02 12:37:18 MST 2011

Quote: ToBeFrank
Makes no sense.


It seems so, its a community contest so i thought this would be a good exercise to start up with my lpc board.. and thought it would be best if i get the source code for this algorithm and Analyze it.. otherwise im afraid i'd never start with it..
I tried to write some basic code, but couldn't link the libraries/drivers.. May i ask Can you provide me with the code? it'd be great for me..
other wise i guess ill have to study through the whole documentation (which is not so good when compared to AVR's, but i really like the features in lpc) and hopefully write the code by myself.. 

Thanks, ill try to come back and post the code if everything works good.

Have a nice day folks.. :)
0 Kudos

329 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ToBeFrank on Wed Nov 02 10:38:10 MST 2011

Quote: graynomad
3 Days:eek:

Sorry, but IMO there's no point even starting.



Exactly. If it truly is "[I]running pretty with an AVR 128[/I]", why would you switch chips 3 days before the deadline? Makes no sense.
0 Kudos

329 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by graynomad on Wed Nov 02 02:11:06 MST 2011
3 Days:eek:

Sorry, but IMO there's no point even starting.

______
Rob
0 Kudos

329 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by raghavendrabsrg on Tue Nov 01 06:06:47 MST 2011
Aleast quite a few snaps of code or hints would be really useful.. I'd really get started good, if i get this program running.. I'm really appreciating the LPC series for its complexity and versatility.. :)
0 Kudos