- Tue Dec 29, 2015 4:13 pm
#37409
Hi Mirko,
The difference between sink/source for a GPIO output can be seen here :
For GPIO0/GPIO2, since they both need to be HIGH for proper boot process, you cannot use source mode, therefore you need to connect the LED as sink mode. And since the LED will be ON when the GPIO is providing a LOW, your software need to be written in such consideration, doing digitalWrite(LED, 0) will turn ON the LED while digitalWrite(LED, 1) will turn it OFF.
For your L293D H Bridge, you don't need the R6 resistor, it is useless...
But there is a side effect of connecting it to GPIO2 : since during the boot process the pin is HIGH, your motor will be turned ON for few microseconds until your code is booted and reach digitalWrite(MOTOR1A, 0) which will turn it OFF.
If this small ON pulse is problematic, you will need to invert the logic there too for the L293D.
It can be accomplish using a NPN transistor or a N-MOSFET along with another pullup on the L293 1A pin.