But have copied script from another programme, which doesn't give this error. What am I doing wrong?

Thanks for your advice in advance.

#!/usr/bin/python
# -*- coding: utf-8 -*-

import os
import time
import RPi.GPIO as GPIO

#setup pin 10 as an output

gpio.setmode(gpio.BCM)
gpio.setmode(10, gpio.OUT)

#Make an LED flash on and off forever
while True:
    gpio.output(10, gpio.HIGH)
    time.sleep(1)
    gpio.output(10, gpio.LOW)
    time.sleep(1)
有帮助吗?

解决方案

Python variable names are case-sensitive.

Replace:

import RPi.GPIO as GPIO

with:

import RPi.GPIO as gpio
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top