12 v outputs on the mega Pi, i can get digital 10 to fire, but not A0 whats up?


#1

What is the address of the other pins?

this works great, for one pair of outputs, but A0 has got me stumped.

{
digitalWrite(10,1);
_delay(0.2);
digitalWrite(10,0);
_delay(0.8);
}


#2

Hi Kevin,

Here is the schematic of MegaPi board to you for reference.Schematic.zip (102.0 KB)


#3

thanks!
I can get the digital pins to react to code,
but the A0 output i have no luck with, i just need it to send pulses of power to a water valve.
the Digital side works great with this code, but nothing on the Analog side.
25%20PM


#4

I figured it out!
you have to call the Analog pins “A0”
working code below,

// Two solenoids open staggered by 150

// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
pinMode(A0, OUTPUT);
pinMode(10, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
analogWrite(A0, 250); // Intake OPEN
delay(150);// wait for a second

analogWrite(A0, 0); //Intake CLOSE
analogWrite(13, 1032);
delay(100);

digitalWrite(10, 1); //Output OPEN
analogWrite(13, 250);
delay(350);

digitalWrite(10, 0);   //Output CLOSED

analogWrite(13, 50);
delay(600);
}