logo

请问下为什么报错?SyntaxError:invalid syntax

2018-11-09 17:10
F
_52ad

# Untitled - By: Administrator - 周五 十一月 9 2018

import sensor, image, time,Pin

from pyb

sensor.reset()

sensor.set_pixformat(sensor.RGB565)

sensor.set_framesize(sensor.QVGA)

sensor.skip_frames(time = 2000)

clock = time.clock()

while(True):

clock.tick()

img = sensor.snapshot()

print(clock.fps())

# 连接一个开关到Pin0,当开关闭合的时候,引脚置低。然后Pin1会点亮

pin0 = Pin('P0', Pin.IN, Pin.PULL_UP)

pin1 = Pin('P1', Pin.OUT_PP, Pin.PULL_NONE)

pin1.value(not pin0.value())

I
网红小智智 星瞳科技

语法错误。

缩进错了

I
网红小智智 星瞳科技

缩进就是4个空格,python不能随便加缩进。

F
_52ad

我把缩进删除了也不行 同样报错 你能帮我修好再发过来吗?

I
网红小智智 星瞳科技

不能,需要自己写代码。

I
网红小智智 星瞳科技

我们的例子都是可以直接运行的,你需要自己改代码。