Hey guys, today we will be using the arduino to control a motor!
to wire this just use this drawing I made in fritzing:
Unfortunately, these kinds of motors do not have an adapter that will allow you to connect it to the arduino, so I had to solder two jumper cables on each of those little metal things that come out of the motor and connect one to ground and the other to pin 6. This code will make that motor start spinning:
void setup() {
pinMode (6, OUTPUT);
}
void loop() {
digitalWrite (6, HIGH);
}
Now upload this sketch to your arduino and the motor should start spinning. Which direction does it spin? now try swapping the cables, which way does it spin now? With most motors, it should be spinning in the opposite direction! If you have any problems do not forget to comment them!
please follow me on this blog, and on twitter @axtyab, and hopefully refer this blog to others that you know!
Comments
Post a Comment