Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 18:38 18 Apr 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Beginners blinking led code

Author Message
FrankMc

Newbie

Joined: 09/08/2011
Location: Australia
Posts: 16
Posted: 06:20am 28 Aug 2011
Copy link to clipboard 
Print this post

Hi Guys

Apologie,s for the newbie questions..But do we have any sample code for say blinking an led...

Thanks
Frank
Edited by FrankMc 2011-08-29
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2867
Posted: 06:46am 28 Aug 2011
Copy link to clipboard 
Print this post

  FrankMc said   Hi Guys

Apologie,s for the newbie questions..But do we have any sample code for say blinking an led...

Thanks
Frank


Hi Frank,

This code will flash the Power LED is actually on Pin(0)


10 pause 500:pin(0)=0:pause 500:pin(0)=1:pause 500:pin(0)=0:pause 500:pin(0)=1:pause 500:pin(0)=0:pause 500:pin(0)=1


If you want to blink an LED on another I/O pin you will need to set it first as a Digital Output Setpin x,8 (see page 13 of the manual) where x is the pin you wish to use.

Regards,

MickEdited by bigmik 2011-08-29
Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
FrankMc

Newbie

Joined: 09/08/2011
Location: Australia
Posts: 16
Posted: 07:27am 28 Aug 2011
Copy link to clipboard 
Print this post

  bigmik said  
  FrankMc said   Hi Guys

Apologie,s for the newbie questions..But do we have any sample code for say blinking an led...

Thanks
Frank


Hi Frank,

This code will flash the Power LED is actually on Pin(0)


10 pause 500:pin(0)=0:pause 500:pin(0)=1:pause 500:pin(0)=0:pause 500:pin(0)=1:pause 500:pin(0)=0:pause 500:pin(0)=1


If you want to blink an LED on another I/O pin you will need to set it first as a Digital Output Setpin x,8 (see page 13 of the manual) where x is the pin you wish to use.

Regards,

Mick


Hi Mick

I copied and pasted the sample you gave but when i hit enter no flashy led...Do you have to type each command in with line number...??
Thanks
Frank
 
ajkw
Senior Member

Joined: 29/06/2011
Location: Australia
Posts: 290
Posted: 07:46am 28 Aug 2011
Copy link to clipboard 
Print this post

Frank,

Did you run the program after pasting in Mick's code??

Another example would be

5 ppin = 1
10 for i = 1 to 20
20 ppin = not (ppin) 'ppin value will alternate a value of 0 or 1
30 pin(0) = ppin 'set the led on or off per value of ppin
40 pause 200 'pause for a time in milliseconds.
50 next i
60 pin(0) = 1 'leave the led on once we are finished

Anthony.
 
donmck

Guru

Joined: 09/06/2011
Location: Australia
Posts: 1310
Posted: 07:51am 28 Aug 2011
Copy link to clipboard 
Print this post


If you have an SD Card Frank, just copy the file as "flash0.bas" to it.

Then load "flash0.bas" to the maximite.

"list" to make sure it is there.

Then "run"
https://www.32v8.com/1
 
Gizmo

Admin Group

Joined: 05/06/2004
Location: Australia
Posts: 5012
Posted: 07:56am 28 Aug 2011
Copy link to clipboard 
Print this post


10 setpin 0,8
20 pin(0)=1
30 pause 200
40 pin(0)=0
50 pause 200
60 goto 20

The best time to plant a tree was twenty years ago, the second best time is right now.
JAQ
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2867
Posted: 09:42am 28 Aug 2011
Copy link to clipboard 
Print this post

  FrankMc said  
  bigmik said  
  FrankMc said   Hi Guys

Apologie,s for the newbie questions..But do we have any sample code for say blinking an led...

Thanks
Frank


Hi Frank,

This code will flash the Power LED is actually on Pin(0)


10 pause 500:pin(0)=0:pause 500:pin(0)=1:pause 500:pin(0)=0:pause 500:pin(0)=1:pause 500:pin(0)=0:pause 500:pin(0)=1


If you want to blink an LED on another I/O pin you will need to set it first as a Digital Output Setpin x,8 (see page 13 of the manual) where x is the pin you wish to use.

Regards,

Mick


Hi Mick

I copied and pasted the sample you gave but when i hit enter no flashy led...Do you have to type each command in with line number...??
Thanks
Frank


The line number (10) is there..

When you cut and pasted it should have loaded the program into the Maximite

To start the program

type RUN

Regards,

Mick


Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
FrankMc

Newbie

Joined: 09/08/2011
Location: Australia
Posts: 16
Posted: 10:11am 28 Aug 2011
Copy link to clipboard 
Print this post

  bigmik said  
  FrankMc said  
  bigmik said  
  FrankMc said   Hi Guys

Apologie,s for the newbie questions..But do we have any sample code for say blinking an led...

Thanks
Frank


Hi Frank,

This code will flash the Power LED is actually on Pin(0)


10 pause 500:pin(0)=0:pause 500:pin(0)=1:pause 500:pin(0)=0:pause 500:pin(0)=1:pause 500:pin(0)=0:pause 500:pin(0)=1


If you want to blink an LED on another I/O pin you will need to set it first as a Digital Output Setpin x,8 (see page 13 of the manual) where x is the pin you wish to use.

Regards,

Mick


Hi Mick

I copied and pasted the sample you gave but when i hit enter no flashy led...Do you have to type each command in with line number...??
Thanks
Frank


The line number (10) is there..

When you cut and pasted it should have loaded the program into the Maximite

To start the program

type RUN

Regards,

Mick



Thanks Mick

That did the trick....Looks like i have lots of reading to do...

Frank
 
FrankMc

Newbie

Joined: 09/08/2011
Location: Australia
Posts: 16
Posted: 10:28am 28 Aug 2011
Copy link to clipboard 
Print this post

Thanks for the replys guys

im going to build Rohans boards and then try and get some i/o working...I have the Maximite manual prined out so i,ll read some but im sure i,ll have more dumb questions soon..

Frank
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2867
Posted: 08:43pm 28 Aug 2011
Copy link to clipboard 
Print this post

  FrankMc said  
Thanks Mick

That did the trick....Looks like i have lots of reading to do...

Frank


No worries,

We all start somewhere...

Now the fun begins..


regards,

Mick

Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
donmck

Guru

Joined: 09/06/2011
Location: Australia
Posts: 1310
Posted: 08:49pm 28 Aug 2011
Copy link to clipboard 
Print this post


Reminds me of when I wrote my first "HELLO WORLD" program in March 1978 on my TRS-80 Model-I.

Don't do what I did. Spend 8 hours writing a program, then have your wife switch your computer off, so she can plug in a double adapter to do the ironing, and you haven't done a back up.

Cheers Don...
https://www.32v8.com/1
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2867
Posted: 08:52pm 28 Aug 2011
Copy link to clipboard 
Print this post

  donmck said  
Reminds me of when I wrote my first "HELLO WORLD" program in March 1978 on my TRS-80 Model-I.

Don't do what I did. Spend 8 hours writing a program, then have your wife switch your computer off, so she can plug in a double adapter to do the ironing, and you haven't done a back up.

Cheers Don...


I bet it was the BEST program ever written in the history of the world too?


Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
aargee
Senior Member

Joined: 21/08/2008
Location: Australia
Posts: 255
Posted: 09:46am 29 Aug 2011
Copy link to clipboard 
Print this post

Gees, Don, it took you eight hours to write a "Hello World" program?

- Rob


For crying out loud, all I wanted to do was flash this blasted LED.
 
donmck

Guru

Joined: 09/06/2011
Location: Australia
Posts: 1310
Posted: 03:25pm 29 Aug 2011
Copy link to clipboard 
Print this post

  aargee said   Gees, Don, it took you eight hours to write a "Hello World" program?
- Rob


Yes, and flashing LEDs took 16 hours, so these newbies "ain't seen nothing yet".

I didn't realize that some newbies had no programming experience whatsoever, so the flashing LED type programs, are a very good step in the right direction.

If we are to introduce Maximites to kids and schools, we need some basic tutorials, to get them started.

I am prepared to host something on my blog, but writing them is another thing, as I am always pushed for time.

If no one else wants to do something, I may attempt something simplistic to at least get it started.

Cheers Don...


https://www.32v8.com/1
 
Dinosaur

Guru

Joined: 12/08/2011
Location: Australia
Posts: 303
Posted: 11:14pm 29 Aug 2011
Copy link to clipboard 
Print this post

Hi all

I would start by pointing them to here
http://www.o-bizz.de/qbtuts/gw-train/index.htm

Then it only needs a small article about the oddities of the MmBasic.

Regards
Regards
Hervey Bay Qld.
 
Worm

Newbie

Joined: 30/06/2011
Location: New Zealand
Posts: 38
Posted: 11:26pm 29 Aug 2011
Copy link to clipboard 
Print this post

Don, Im sure that would be an appreciated by a lot of newbies including myself. Progaming can be very difficult and frustating to learn without help and also very rewarding when something works. Tutorials with some code would be very helpfull including some simple things that we take for granted like always start with the "NEW" command so we dont end up with a mixed up program from previous tries that may stop it from working.

Thanks
Kevin
There's no such thing as a free lunch.
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024