How to determine ALPHA, smoothing constant, of a LPF?
All formulas I'm using come from the wikipedia page you cite in your code.

First, calculate RC. We have,

fc = 1/(2*pi*RC)


so

RC = 1/(2*pi*fc)


Now, ALPHA is simply:

ALPHA = dt / ( dt + RC )


where dt is 1/samplerate.

For your values (samplerate=350, fc=4) I got

ALPHA = 0.0670


Caveat: I tried this on a few other values and the shape of the filter was what I expected, but the exact 3dB cutoff frequency was never quite where it should have been. Not sure if this indicates something wrong, or that's just the nature of the beast.