Society of Robots - Robot Forum

Software => Software => Topic started by: goatfish on April 27, 2008, 05:02:24 AM

Title: better basic code
Post by: goatfish on April 27, 2008, 05:02:24 AM
i have just learned simple commands in BASIC code
such as  
Code: [Select]
name$ = Input("What is your name? ")
Print "Hello " + name$
WaitKey()

does anyone have anything more inetresting to do than that?

p.s.-im only a begginer
Title: Re: better basic code
Post by: Steve Joblin on April 27, 2008, 08:49:44 AM
Great start!!!

There are lots you can do with BASIC... even with robotics!  There are several "special" versions of BASIC that enable you to interact with electronics (specifically, microcontrollers).  I would check out two sites... the first is Parallax who makes the BASIC STAMP II microcontroller.  You can program their microcontroller using a special version of BASIC called PBASIC.  I would also check out PICAXE.  They also make microcontrollers that can be programmed in a special version of BASIC.
Title: Re: better basic code
Post by: izua on April 27, 2008, 11:22:25 AM
try making a simple calculator :P that was my first basic code
Title: Re: better basic code
Post by: goatfish on April 29, 2008, 01:17:04 AM
yea i nedd someone to show me how to make a calculator,but not give it all away so i can learn,please try to show me in the next 28 days,its a 30 day trial i am using  :)
Title: Re: better basic code
Post by: Admin on May 02, 2008, 03:21:05 PM
What about a program that asks you questions then responds differently depending on your answer?

You should look up BASIC tutorials online . . .

Also, yesterday was BASIC's birthday :D
http://www.wired.com/science/discoveries/news/2008/04/dayintech_0501
Title: Re: better basic code
Post by: oldandwise on May 04, 2008, 02:57:13 AM
yea i nedd someone to show me how to make a calculator,but not give it all away so i can learn,please try to show me in the next 28 days,its a 30 day trial i am using  :)
Hi Goatfish,

noticed your comment 30Day trial!
There are several free full versions available on the net, GCBASIC, and (Mikroelektronika), Mikrobasic, to name two.

I suggest you get such a full version and take away the stress of worrying when your programme runs out of time, that way you can relax and play and learn at your leasure.

All the best with your trials, remember "to finish one must first start", Greetings Brian
Title: Re: better basic code
Post by: izua on May 04, 2008, 08:48:30 AM
check out for loops - a very useful element in programming (FOR..NEXT is in basic, WHILE..WEND, DO...UNTIL)
Code: [Select]
FOR i = 1 to 5 step 1
PRINT i
NEXT i

another useful thing that makes a program smart is an IF - ELSE - ENDIF clause
Code: [Select]
a = 3
IF a < 10 then PRINT "a is less than 10"
ELSE PRINT "a is greater or equal to 10"
ENDIF
Title: Re: better basic code
Post by: goatfish on May 06, 2008, 01:10:49 AM
yea i need to know how to use to the if statement,so i can have it do different things if there is a different repsonse
Title: Re: better basic code
Post by: pomprocker on May 06, 2008, 11:55:04 AM
putting all programming languages aside you have the same structures. I recommend you learn your control structures and data structures first. then you can learn some syntax of whatever programming language.

learn about structure flow, commands like goto, break, and continue are actually a big no-no in good programming practice.

http://en.wikipedia.org/wiki/Control_flow (http://en.wikipedia.org/wiki/Control_flow)

http://en.wikipedia.org/wiki/Structured_programming (http://en.wikipedia.org/wiki/Structured_programming)


If your interested in programming (aside from robotics) I recommend you learn object oriented programming first (using abstract thinking) because that is where its at today.

If you learn process oriented programming first(basic, c) then you will have a harder time with OOP.

Title: Re: better basic code
Post by: pomprocker on May 06, 2008, 11:59:10 AM
yea i need to know how to use to the if statement,so i can have it do different things if there is a different repsonse


I haven't programmed in BASIC in a couple years, but if you have more than three scenarios you want to use the switch statement.

also, know the difference between pre-test loops, and post-test loops.

Learn how to use pseudocode to.

http://en.wikipedia.org/wiki/Pseudocode (http://en.wikipedia.org/wiki/Pseudocode)