Hello all. I've been working on a motorcycle controller for some time and have it mostly worked out except for some blips I'm getting on startup. I've routed out a board that uses MOSFET's to control outputs and switches to ground for input. I've been reading a bit about startup blips on outputs and it's often suggested that it is because of the tristate pins floating high on turn on before they are assigned as outputs. This, however, does not seem to be the case because if I remove the 'if' statement for this output from the main code it no longer blips at startup, suggesting that the if statement itself is causing the problem. The only outputs I've noticed this on are 'horn' and 'starter,' though it could be happening on other outputs I'm not aware of.
The board is a Sainsmart Nano. I can post the schematic if anyone likes, but it is somewhat complicated and I adjusted it a little on the actual board.
Dose anyone have any insight into how to code the 'if' statement(s) to avoid it popping on during startup?
Specifically, here is the 'if' statement for the starter that I have been trying to work out (mainly because the starter blipping on is really not cool!):
//Starter Relay
//Energize starter relay
if ((digitalRead(StartSwitch)) == LOW)
digitalWrite( StarterRelay , HIGH );
else
digitalWrite( StarterRelay , LOW );
Bike_Program.abp.ino (9.21 KB)
