Monday 20 June 2016

Basic motor control using CodeBug



A simple transistor circuit is used here to get the CodeBug to control a small motor, turning it on or off.
Drawn using Schemeit (http://www.digikey.co.uk/schemeit/project/

The motor used here was a small cell-phone vibration motor, but it has been tried with other small motors.




Using ‘leg 1’ to switch the motor on or off, +5v comes from the CodeBug PWR connector and GND come from the CodeBug. It can only drive the motor in one direction.

In the code below Button A switches on the motor and Button B switches the motor off.






All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with.

No comments:

Post a Comment

Top posts on this blog in March 2024

The Top 10 viewed post on this blog in March 2024. Covering areas such as small robots, augmented reality, Scratch programming, robots. Micr...