查看: 751|回复: 2

canMV IDE初次编译运行代码报错

[复制链接]

1

主题

1

回帖

207

积分

中级会员

Rank: 3Rank: 3

积分
207
发表于 2024-5-22 17:43:51 | 显示全部楼层 |阅读模式
代码:
# Hello World Example
#
# Welcome to the CanMV IDE! Click on the green run arrow button below to run the script!

import sensor, image, time, lcd

lcd.init()                          # Init lcd display
lcd.clear(lcd.RED)                  # Clear lcd screen.

sensor.reset()                      # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QVGA)   # Set frame size to QVGA (320x240)
sensor.skip_frames(time = 2000)     # Wait for settings take effect.
clock = time.clock()                # Create a clock object to track the FPS.

while(True):
    clock.tick()                    # Update the FPS clock.
    img = sensor.snapshot()         # Take a picture and return the image.
    lcd.display(img)                # Display image on lcd.
    print(clock.fps())              # Note: CanMV Cam runs about half as fast when connected
                                    # to the IDE. The FPS should increase once disconnected.
报错:
Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
ImportError: no module named 'sensor'
回复

使用道具 举报

1

主题

1

回帖

207

积分

中级会员

Rank: 3Rank: 3

积分
207
 楼主| 发表于 2024-5-22 17:46:22 | 显示全部楼层
1)初次安装好canmv,然后运行代码
2)代码是实例代码
3)报错了,但是直接printf(“hello world”),没问题,单纯写这么一行
回复 支持 反对

使用道具 举报

66

主题

8

回帖

396

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
396
发表于 2024-5-22 18:06:20 | 显示全部楼层
下载v0.6版本的镜像,应该是能正常工作的
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|风火轮WIKI|手机版|小黑屋|深圳风火轮团队 ( 粤ICP备17095099号 )

GMT+8, 2024-9-8 08:01 , Processed in 0.046832 second(s), 19 queries .

快速回复 返回顶部 返回列表
 
【客服1】 商务合作 15289193
【客服2】 业务洽谈 13257599
【客服3】 售前咨询 510313198
【邮箱】
smartfire@smartfire.cn