Author Topic: better basic code  (Read 2835 times)

0 Members and 1 Guest are viewing this topic.

Offline goatfishTopic starter

  • Full Member
  • ***
  • Posts: 117
  • Helpful? 1
better basic code
« 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

Offline Steve Joblin

  • Supreme Robot
  • *****
  • Posts: 405
  • Helpful? 2
Re: better basic code
« Reply #1 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.

Offline izua

  • Supreme Robot
  • *****
  • Posts: 682
  • Helpful? 0
Re: better basic code
« Reply #2 on: April 27, 2008, 11:22:25 AM »
try making a simple calculator :P that was my first basic code
Check out my homepage for in depth tutorials on microcontrollers and electronics.

Offline goatfishTopic starter

  • Full Member
  • ***
  • Posts: 117
  • Helpful? 1
Re: better basic code
« Reply #3 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  :)

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,666
  • Helpful? 169
    • Society of Robots
Re: better basic code
« Reply #4 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

Offline oldandwise

  • Beginner
  • *
  • Posts: 4
  • Helpful? 0
Re: better basic code
« Reply #5 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

Offline izua

  • Supreme Robot
  • *****
  • Posts: 682
  • Helpful? 0
Re: better basic code
« Reply #6 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
Check out my homepage for in depth tutorials on microcontrollers and electronics.

Offline goatfishTopic starter

  • Full Member
  • ***
  • Posts: 117
  • Helpful? 1
Re: better basic code
« Reply #7 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

Offline pomprocker

  • Supreme Robot
  • *****
  • Posts: 1,430
  • Helpful? 16
  • Sorry miss, I was giving myself an oil-job.
Re: better basic code
« Reply #8 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/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.


Offline pomprocker

  • Supreme Robot
  • *****
  • Posts: 1,430
  • Helpful? 16
  • Sorry miss, I was giving myself an oil-job.
Re: better basic code
« Reply #9 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






 


Get Your Ad Here

data_list