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
-
1Hello 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– Ghanima ♦2016年02月19日 07:33:32 +00:00Commented Feb 19, 2016 at 7:33
-
sorry i paste code in commentMangesh Shelke– Mangesh Shelke2016年02月19日 07:36:52 +00:00Commented Feb 19, 2016 at 7:36
-
i am new here !!!Mangesh Shelke– Mangesh Shelke2016年02月19日 07:37:54 +00:00Commented 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– Ghanima ♦2016年02月19日 07:38:39 +00:00Commented Feb 19, 2016 at 7:38
1 Answer 1
It's GPIO.BCM you want. Dot rather than comma.
GPIO.setmode(GPIO.BCM)
answered Feb 19, 2016 at 8:11