I have a problem with Project 9 - motorised pin wheel.
When I first plugged in the Arduino, the wheel started spinning even without any code in, but was not controlled by the switch. Then when I put the code in, the wheel doesn't spin anymore.
Here is my code
const int switchPin = 2;
const int motorPin = 9;
int switchState = 0;
I have tried the following to resolve the issue --
I tried changing the transistor
I tried changing the switch
I have tried erasing with the reset button and uploading.
Putting gaps between the void codes
I have changed the resistor
I think that you misplaced the switch by one row on your breadboard, so that is is effectively not connected at all.
Also take care to mount the switch in the right orientation. Two adjacent pins are always connected, so that it can happen that the switch appears closed all the time. If so, turn it by 90° to access pins from both connected pairs.
Thank you! That solves one problem. But the other problem I now have is that it doesn't work form batter supply only, it only works connected to my computer... Any thoughts? Thanks again! Warmly, Natasha