I'm a little confused with pin numbers on the Picaxe 28 project board

I have a motor driver fitted to the board, and 2 motors connected to the 2 sets of motor pins. These motors are driven in the code using low 4 : high 5 : high 6 : low 7.

I have a servo fitted to pin 0, and some led's fitted to pins 1, 2, and 3.

This all works fine, and it does what I want.

There are "vacant" digital output pins, which are numbered on the board 4, 5, 6 and 7, which are the same numbers that the motors use.

I want to fit a speaker to pin 4 (as numbered on the board) but am worried that I may blow something up, or at least I can't seem to get my head around using the same numbers for different things.

Can someone explain it to me, or at least tell me if it would be OK or not.

Thanks :)

You guessed right

Pins 4-7 on the digital/binary output port are hardwired into the motor driver.

You might have better luck with using input pins as outputs. See the infamous node 75 for details.

The motor driver is

The motor driver is optional. If you don’t use it, digital pins 4,5,6, and 7 are available for normal use.

If you use the motor driver, pins 4,5,6, and 7 are still active, but they are also driving the motor driver. If you use them to drive something in parallel, be careful how much current you pull.

Also, if you use code on pin 4 to make a speaker go, you will wind up sending a command to the motor driver. Conversely, when you command pin 4 high to run the motor, you will be affecting the speaker output as well. You may here a click on the speaker as you transition from high to low or vice-versa.

You might have better luck sharing one of the LED pins with the speaker. If the LED is off, you can send sound to that output. The LED may even flash interestingly along with the sound signal.

Edit: Or, as I just recalled (as I saw rik’s post) you can reconfigure some of your input pins as outputs. Duh.

Thanks for that, fellas.

I think I’ve got it right, but haven’t tested it yet.

Looking up the Picaxe documentation (which I should have done in the first place) it seems that all I need to do is write high portc 1 (or low) and connect one of the LED connectors to the digital input pin 1 (freeing up one of the digital output pins). It seems that you can’t use sound on those pins, only on/off.

You’ll know when I’ve got it sussed, a new bot will go up :wink:

Speaker

Which 28X are you using?

To add a speaker, make sure you use a 10.uF 16v cap to speaker

and then the other leg of the speaker to Ground.

When you talk about PINS, you are talking about the function of

the PCAXE, When you talk about LEGS,  your talking about

the physical LEG of the PICAXE.

See my link about this info, or go to Manual #3 page 10

My Site: http://elecurls.tripod.com

Choose: PICAXE

Hope that helps,

-teddy7

 

 

"To add a speaker, make sure

"To add a speaker, make sure you use a 10.uF 16v cap to speaker" Why? I never?!

The board that he uses has a darlington - is that used, or ? I need more info :slight_smile: