Run out of pins

Hi gang, sorry if this post is in the wrong section,
Having now designed on paper, what I think I need to do for my project, I have discovered that I have run out of the digital PWM pins

0 = RX ( NOT USED )
1 = TX ( NOT USED )

2 = XSHUT ( FROM SENSOR 1 )
3 = XSHUT ( FROM SENSOR 2 )
4 = XSHUT ( FROM SENSOR 3 )
5 = XSHUT ( FROM SENSOR 4 )
6 = DIR ( STEP DRIVER 1 )
7 = STEP ( STEP DRIVER 1 )

8 = ENABLE ( STEP DRIVER 1 )
9 = DIR ( STEP DRIVER 2 )
10 = STEP ( STEP DRIVER 2 )
11 = ENABLE ( STEP DRIVER 2 )
12 = LIMIT SWITCH 1
13 = LIMIT SWITCH 2

I need a way to connect a push button on/off switch, so that I can start the installed script when I choose it to start running, and not from when I plug in power or connect via usb.

ta muchly.

Use the analogue pins as.digital pins

^ wot he said.

And/or start adding some extra i/o pins with chips like pcf8574. Up to 8 chips can be connected to A4+A5 (the i2c bus) and each chip gives you 8 inputs or outputs.

Also suggest you use PWM pins which are internally attached to 2 different timers for your STEP pins. This allows you to run the motors independently at different or the same speeds without having to send each pulse in your code.

Thank you PaulRB, but unfortunately I haven’t a clue on the programming side of things concerning arduino’s only from what I find already done in diagrams, pics, script, and I am searching for a local special person to help me.
I can only hazzard a guess in what your saying is to change my connections, so that the 3 connections (Y/B/G) from the x2 A4988 get moved / connected to the digital pwm pins marked with (~).
As for the on/off start button I require, and again a guess, is connecting it to the A2 and A3 pins. ???,
I have searched for this alternative, and any related code, that I could get someone to merge with the others examples I have found, but did not find any.

zzrblokey:
As for the on/off start button I require, and again a guess, is connecting it to the A2 and A3 pins. ????,
I have searched for this alternative, and any related code, that I could get someone to merge with the others examples I have found, but did not find any.

You use them just like any of the other digital pins - pinMode(), digitalRead(), etc. Just substitute A0-5 for the pin number. Better still, assign a name - const byte switch_1 = A0 - and use the name.

And YET AGAIN we see a user completely unaware than "analog pins" can do digital I/O. The convention of calling them "analog pins" and "digital pins" just leads people astray.

It would have been much less confusing if they described analogRead() / ADC capability as an added feature that a pin can have, like how certain pins can do TX/RX, or I2C, or PWM via analogWrite - as that's a much better way of explaining what they do... But anyway, that's how to think of them.

There are only two pins (as far as I am aware) in Atmel's entire AVR product line that are analog-input-only - those are channels 6 and 7 (A6, A7) on the surface mount version of the '328p (and the smaller-flash versions of those chips); they're available on the Nano and Pro Mini, which use that part. My understanding is that Atmel released the 28-pin DIP version of that part first (like what the Uno uses), then as the world moved to surface mount, and they released the 32-pin surface mount version, they had 4 extra pins. They put an extra ground and power pin on two of them, and connected the other two to additional ADC channels (which I suspect were either there all along, analog multiplexers are generally in powers of two). But they couldn't make them into full-fledged pins without adding output drivers and digital input buffers for those pins, as well as the registers to control them - so analog input-only they were. Much more recently, when Atmel released the '328pb (an improved version of the 328p, only made in the SMD package), they made those two pins, as well as a pair of pins that were power/ground on the '328p, into a new 4-pin port with full capabilities. But I digress...

Only the STEP pins can benefit from being connected to a PWM pin. The ENABLE & DIR pins can't benefit from a PWM pin, so any digital pins will do for them.