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)
Jacobm001
11.9k7 gold badges48 silver badges58 bronze badges
asked Feb 19, 2016 at 7:29
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.) Commented Feb 19, 2016 at 7:33
  • sorry i paste code in comment Commented Feb 19, 2016 at 7:36
  • i am new here !!! Commented 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. Commented Feb 19, 2016 at 7:38

1 Answer 1

6

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

GPIO.setmode(GPIO.BCM)
answered Feb 19, 2016 at 8:11
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.