Can set pins with pinMode to output, and digitalWrite a HIGH (almost 5volt) or LOW (almost ground) to it.
But if there are problems, you know where to look first.
There is nothing better than a real VCC and ground.
sjiamnocna:
I know, I can simulate voltage 3.3V by using analogWrite(vcc, 168) (3.3÷(5÷255))
Not true.
A Mega doesn't have analogue outputs, only PWM outputs.
AnalogWrite (misnomer) generates a 5volt PWM signal with varying duty cycle, not a voltage.
Only the 3.3volt pin outputs 3.3volt (150mA absolute max).
Leo..
sjiamnocna:
I know, I can simulate voltage 3.3V by using analogWrite(vcc, 168) (3.3÷(5÷255)), but how do I do GND on pin 19?
Sorry, it doesn't work like that.
analogWrite produces a digital logic signal, being a PWM rectangular waveform, capable of only small
currents and intolerant of large capacitive loads. This is not a simulation of 3.3V at all.
Your AD8232 board is highly capacitive on its 3.3V supply pin, as its got decoupling capacitors like
any logic circuit.
Basically you need a stable 3.3V power supply to power that AD8232 board, not a logic signal.
Same goes for ground, a logic output cannot be supply ground, its far too high an impedance and
cannot drive large capacitive loads.
BTW such a heart-rate monitor like that must be battery powered for safety.
So you say, It's not possible and i change only the rectange signal duty period, so the way I can go is e.g. solder the power, GND upside, use a wire and connect the rest to the board pins?
And MarkT says, that ideally I'd get 3V battery and use it as power source?