Things used in this project

Hardware components:
Chip%20v1
C.H.I.P.
×1
DC motor (generic)
×1
Omron b3f 1000 image 75px
Tactile Button Switch (6mm) Single
×1
09590 01
LED (generic)
×1
Fairchild semiconductor fqu13n06ltu image 75px
Power MOSFET N-Channel
I used an IRF510
×1
Fairchild semiconductor pn2222abu. image
General Purpose Transistor NPN
I used an 2N3904
×1
Mfr 25fbf52 4k75 sml
Resistor 4.75k ohm
×2
12002 04
Breadboard (generic)
×1
Male/Male Jumper Wires
Some wires...
×10

Schematics

The Circuit Diagram
Wire it up carefully.
Circuit diagram.jpg

Code

MotorOnSw.pyPython
Press the button to switch the motor and LED on.

You need to install the AdaFruit C.H.I.P. GPIO library first of all. See here for instructions, usage guides and tips and other stuff: https://bbs.nextthing.co/t/adafruit-gpio-library-for-chip/2696
#!/usr/bin/python
#
# Nick Pettefar - 14th July 2016
#
import CHIP_IO.GPIO as GPIO
from time import sleep
#
delay=0.01
Motor = "XIO-P2"
LED = "XIO-P4"
Switch = "XIO-P0"
GPIO.setup(Motor, GPIO.OUT)
GPIO.setup(LED, GPIO.OUT)
GPIO.setup(Switch, GPIO.IN, pull_up_down=GPIO.PUD_UP)
#
GPIO.output(Motor, GPIO.LOW)
GPIO.output(LED, GPIO.LOW)

try:
    while True:
        while GPIO.input(Switch)==1:
            sleep(delay)
        GPIO.output(Motor, GPIO.HIGH)
        GPIO.output(LED, GPIO.HIGH)
        sleep(delay)
        GPIO.output(Motor, GPIO.LOW)
        GPIO.output(LED, GPIO.LOW)

except KeyboardInterrupt:
    GPIO.output(Motor, GPIO.LOW)
    GPIO.output(LED, GPIO.LOW)

Credits

Nick head
Nick Pettefar

Unix biker Radio Ham bad Ukulele player.

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Garden sensors dashboard
Intermediate
  • 10
  • 0

Full instructions

Monitor your greenhouse or personal garden environmental variables at a glance with a Linkit enabled sensor Hub.

Smart Cap
Intermediate
  • 1,306
  • 8

Full instructions

Good vision is a precious gift but unfortunately loss of vision is becoming common now-a-days. Smart cap can help with navigation.

Make an "Air" Drum Kit with Curie Nano
Intermediate
  • 58
  • 0

Full instructions

Enjoy playing drums anytime anywhere without worrying about making noise or disturbing others - just attach Curie to your drum sticks!

Find Me
Intermediate
  • 224
  • 0

Full instructions

Tired of losing your keys, wallet and phone? Attach the Find Me to any item and use the app to locate it in seconds.

Spideruino
Intermediate
  • 7,069
  • 38

A Lego arachnid controlled by your smartphone.

C.H.I.P.py Ruxpin ʕ•ᴥ•ʔ
Intermediate
  • 44,118
  • 68

Full instructions

Bring Teddy Ruxpin back to life, but on your own terms! Make him say whatever you want, or have him search twitter to read tweets!

Add projectSign up / Login
Respect project