0

I recently purchased a Raspberry Pi 2 and I am trying to run a simple a simple Blink program but getting this error:

name error 'BCM' is not defined

This is my script

import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO,BCM)
GPIO.setwarnings(False)

led = 7

while True:
    GPIO.output(led,1)
    time.sleep(2)
    GPIO.output(led,0)
4
  • 1
    Hello and welcome. Please be so kind to share your program/script you're running. (Note that you can always edit your own question to include that information, no need to go through comments.)
    – Ghanima
    Feb 19, 2016 at 7:33
  • sorry i paste code in comment Feb 19, 2016 at 7:36
  • i am new here !!! Feb 19, 2016 at 7:37
  • Not a problem, I edited the question for you. You are new to the site, we're here to help you along. Take the tour and visit the helpcenter to see how things work here.
    – Ghanima
    Feb 19, 2016 at 7:38

1 Answer 1

6

It's GPIO.BCM you want. Dot rather than comma.

GPIO.setmode(GPIO.BCM)
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.