We need to count the pulses from a flow sensor, which is working fine with the script we have but then we also need to send the same pulses out via another pin as the "pulse reader" we have has a threshold of 2.5V in order to "read" it as a pulse.
Can anyone help with the code so that the output pin provides a square wave that is 0V,when off and 3V when on? As this has to be exact and not just a rise or drop in voltage.
Thanks.
const int pulsePin = 2;
const int outPin = 13;
int pulseCounter = 0;
int pulseState = 0;
int lastPulseState = 0;
You don't say which board you are using, but generally if you want an accurate output level which isn't 5V or 3.3v (i.e. the supply volts) the best way to derive this is by external circuitry. Depending on the input impedance of your "pulse reader" this could be as simple as a voltage divider to reduce the 5v or 3.3 v at pin 13 to 3v.
Hi Jhaine, sorry I am using an Arduino Uno in this case. The flow sensor i am using is a Piusi K600/3 Pulser. The output voltage on the pin that it is currently on shows 5V on my multimeter but as soon as I start the flow on the se air it drops to a max of 1.4V and a min of 1.3V. Don’t know why this changes is happening…