Hi I'm building a robot and I'm putting the pieces together right now. I got it all to work smoothly but I had some strange behavior with the pulsein combined with switching devices on. I can not explain it so I hope you guys can help me out.
I'm using a mega with 6 bought shields and 1 custom made shield placed behind the uno shields. It is quite a stack I know 8). The custom made shield basically contains a switching regulator for extra power and 2 NPN transistors (TIP102 power Darlington ) as switches plus lots of connections to pins of which 3 to read RC info (45 47 49). The transistors are switched with pins 48 (wifi) and 43 (RemoteControl) using a 6,8K resistor. The weird behavior I get; is that when I switch on the WIFI router the first RC reading I did on pin 47 was always higher than normal. If it was 1100 it went up to 1400. As this is the speed it makes the robot kind of like hicup. Because pin 45 is more a on off switch I started reading pin 45 first (instead of 47) and I do not see this behavior with this pin.
Could this be pin interference ( I'm using PulseIn). Not being limited by any knowledge on this domain, I can hardly believe it. First of all there is some code between the switching on and the start of the pulsein because in my main loop the GPS, powermanager, logger, brains, driveengine are handled before I come to the Remote control so some microseconds should have passed by then. Secondly the WIFI switch cable starts at pin 48 goes to the analog pins. So pin 45 is further away then 47 but would this make the difference?
Anyone has a clue?
Best regards Jantje