First program

wiard

New Member
I have tried this on the tutorial:

4. Connect an LED and 330 ohm resistor to the output pin 4 of the PICAXE chip.

main:
high B.4
pause 1000
low B.4
pause 1000
goto main



And it worked!

I changed to B.4 again and put the wire in B.4
The ground in 0V
The resistor between the B.4 and the anode, with the program in between(if you know what I mean).

Now it works. Great.
 

Attachments

Last edited:

stevesmythe

Senior Member
The long leg of the LED should go, via a (300 Ohm or so) resistor, to +ve (or a Picaxe output port that you can set "high" or "low"). The short leg of the LED should goto -ve. On your picture, it looks like both legs of the LED are connected via a resistor to the same row on the breadboard, therefore no current will flow.

PS All the pins on the top row of the breadboard are connected together, as are the pins on the second row. Similarly the bottom row and the one above it. The other pins on the breadboard are connected in two sets of columns (separated by the slot down the centre). Normally, you would connect a "jumper wire" from one of the V+ connections on the board to the top row and a "jumper wire" from one of the V0 connections on the board to the second row. This then gives you a "+V rail" and a "0V rail". Then you would place your LED onto the breadboard, making sure each leg is in a different column and connect one end of your resistor to the same column as the long leg of the LED and the other end of the resistor to the Picaxe port you are using (or connect it from the breadboard via another wire). Then you can connect a wire from the same column as the short leg of the LED, to the 0V row.
 
Last edited:

stevesmythe

Senior Member
Alternatively, you can use the LEDs already built into the AXE091 just by connecting a wire from the Picaxe port (e.g. B6) to the little socket next to the LED (marked L1, L2 etc.). The other side of those LEDs are already connected, via a 330 Ohm resistor to 0V.
 

wiard

New Member
Thank you very much!

It worked.
I also looked a bit better at the design of the controller.
The B.4 is on number 10.
If I understand it well, this number 10 is now the V+ with a pause and in a loop.

This is really interesting!

What an experience.
 

wiard

New Member
I understood that from a tutorial.
I will try that one as well, but for now I am very happy that this one works.
 

hippy

Technical Support
Staff member
Not sure that the photo and code match each other. It seems you have leg 5 connected to the LED yet are controlling the LED by B.6 in the software, leg 12.
 

stevesmythe

Senior Member
The B.4 is on number 10.
If I understand it well, this number 10 is now the V+ with a pause and in a loop.
Yes, leg 10 of the 18M2 chip is port B.4. Your BASIC program switches that leg/port to V+ for 1 second then V0 for one second and repeats forever.
 

wiard

New Member
Thank you for giving me the proper words to use.
The power is lifted from the LED for that one second?
 

BESQUEUT

Senior Member
And it worked!
Glad to read that !
I am now certain that you will publish lots of code. To enhance readability, please use a
Code:
 tag before your code
and [/ code] just after (without any space) so it look like that :
[code]
main: 
high B.4 
pause 1000
low B.4
pause 1000
goto main
Alternatively the editor may have a contextual menu with a "copy for forum" option.
 

erco

Senior Member
@wiard: Congrats. Pretty cool feeling, huh? Welcome to the dark side! Now you're a geeky coder like the rest of us. :)
 
Top