/ README_ZH.md
README_ZH.md
  1  <img height=200 src="assets/image/maixpy.png">
  2  
  3  <br />
  4  
  5  
  6  <div class="title_pic">
  7      <img src="assets/image/sipeed_logo.svg"  style="margin-right: 10px;" height=45> <img src="assets/image/micropython.png" height=50>
  8  </div>
  9  
 10  <br />
 11  <br />
 12  
 13  <a href="https://github.com/sipeed/MaixPy/actions">
 14      <img src="https://img.shields.io/github/workflow/status/Sipeed/MaixPy/compile%20test%20and%20publish?style=for-the-badge" alt="Master branch build status" />
 15  </a>
 16  <a href="http://dl.sipeed.com/MAIX/MaixPy/release/master/">
 17      <img src="https://img.shields.io/badge/download-master-ff69b4.svg?style=for-the-badge" alt="master build firmware" />
 18  </a>
 19  <a href="https://github.com/sipeed/MaixPy/releases">
 20      <img src="https://img.shields.io/github/release/sipeed/maixpy.svg?style=for-the-badge" alt="Latest release version" />
 21  </a>
 22  <a href="https://github.com/sipeed/MaixPy/blob/master/LICENSE.md">
 23      <img src="https://img.shields.io/badge/license-Apache%20v2.0-orange.svg?style=for-the-badge" alt="License" />
 24  </a>
 25  
 26  <br />
 27  
 28  <a href="https://github.com/sipeed/MaixPy/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22good+first+issue%22">
 29      <img src="https://img.shields.io/github/issues/sipeed/maixpy/good%20first%20issue.svg?style=for-the-badge" alt="Good first issues" />
 30  </a>
 31  <a href="https://github.com/sipeed/MaixPy/issues?q=is%3Aopen+is%3Aissue+label%3Abug">
 32      <img src="https://img.shields.io/github/issues/sipeed/maixpy/bug.svg?style=for-the-badge" alt="Bug issues" />
 33  </a>
 34  <a href="https://github.com/sipeed/MaixPy/issues?q=is%3Aissue+is%3Aopen+label%3Aenhancement">
 35      <img src="https://img.shields.io/github/issues/sipeed/maixpy/enhancement.svg?style=for-the-badge" alt="Enhancement issues" />
 36  </a>
 37  
 38  
 39  
 40  <br/>
 41  <br/>
 42  
 43  
 44  [English](README.md)
 45  
 46  <br />
 47  <br />
 48  
 49  **MaixPy, 让 AIOT 更简单~**
 50  
 51  Maixpy 的目的是让 AIOT 编程更简单, 基于 [Micropython](http://www.micropython.org) 语法, 运行在一款有着便宜价格的高性能 AIOT 芯片 [K210](https://kendryte.com) 上.
 52  
 53  利用 MaixPy 可以做很多事情,具体参考 [这里](https://maixpy.sipeed.com/zh/others/what_maix_do.html)
 54  
 55  > K210 简介 : 
 56  > * 拥有硬件加速的 AI 图像识别
 57  > * 带硬件浮点运算的双核处理器
 58  > * 8MB(6MB+2MB) 内存
 59  > * 16MB 外置 Flash
 60  > * 芯片 CPU 最高可达 800MHz 主频 (开发板支持最高主频具体看开发板介绍, 通常400MHz)
 61  > * 麦克风阵列支持(8个麦克风)
 62  > * 硬件 AES SHA256 支持
 63  > * FPIOA (每个外设可以映射到任意引脚)
 64  > * 外设: I2C, SPI, I2S, WDT, TIMER, RTC, UART, GPIO 等等
 65  
 66  
 67  <img src="assets/image/maix_bit.png" height=500 alt="maix bit"/>
 68  
 69  ## 简单易懂的代码
 70  
 71  寻找 I2C 设备:
 72  
 73  ```python
 74  from machine import I2C
 75  
 76  i2c = I2C(I2C.I2C0, freq=100000, scl=28, sda=29)
 77  devices = i2c.scan()
 78  print(devices)
 79  ```
 80  
 81  拍照:
 82  
 83  ```python
 84  import sensor
 85  import image
 86  import lcd
 87  
 88  lcd.init()
 89  sensor.reset()
 90  sensor.set_pixformat(sensor.RGB565)
 91  sensor.set_framesize(sensor.QVGA)
 92  sensor.run(1)
 93  while True:
 94      img=sensor.snapshot()
 95      lcd.display(img)
 96  ```
 97  
 98  使用 AI 模型进行物体识别:
 99  ```python
100  import KPU as kpu
101  import sensor
102  
103  sensor.reset()
104  sensor.set_pixformat(sensor.RGB565)
105  sensor.set_framesize(sensor.QVGA)
106  sensor.set_windowing((224, 224))
107  
108  model = kpu.load("/sd/mobilenet.kmodel")  # 加载模型
109  while(True):
110      img = sensor.snapshot()               # 从摄像头采集照片
111      out = kpu.forward(task, img)[:]       # 推理,获得 one-hot 输出
112      print(max(out))                       # 打印最大概率的物体ID
113  ```
114  > 具体的使用方法请阅读教程后尝试
115  
116  
117  ## 固件发布
118  
119  发布版本固件: [固件发布页面](https://github.com/sipeed/MaixPy/releases)
120  
121  最新提交(开发中)的固件: [master 分支的固件](http://dl.sipeed.com/MAIX/MaixPy/release/master/)
122  
123  ## 文档
124  
125  查看 [maixpy.sipeed.com](https://maixpy.sipeed.com)
126  
127  ## 例示代码
128  
129  [MaixPy_scripts](https://github.com/sipeed/MaixPy_scripts)
130  
131  ## 从源码构建自己的固件
132  
133  参考 [构建文档](build.md)
134  
135  旧的构建版本请见 [historic 分支](https://github.com/sipeed/MaixPy/tree/historic) (不再维护,仅仅为了保留提交记录)
136  
137  ## 使用在线编译工具定制固件
138  
139  到[Maixhub.com](https://www.maixhub.com/compile.html)使用在线编译定制自己需要的功能
140  
141  ## Maixhub 模型平台
142  
143  到 [Maixhub.com] 获取更多模型和训练自己的模型
144  
145  
146  ## 开源协议
147  
148  查看 [LICENSE](LICENSE.md) 文件
149  
150  ## 其它: 使用本仓库作为 `SDK` 用 `C` 语言开发
151  
152  本仓库除了作为 `MaixPy` 工程的源码存在以外, 由于`MaixPy`作为一个组件存在, 可以配置为不参与编译, 所以也可以作为 `C SDK` 来进行开发, 使用方法见 [构建文档](build.md), 可以从编译下载`projects/hello_world`开始
153  
154  大致上编译下载过程如下:
155  
156  ```
157  wget http://dl.cdn.sipeed.com/kendryte-toolchain-ubuntu-amd64-8.2.0-20190409.tar.xz
158  sudo tar -Jxvf kendryte-toolchain-ubuntu-amd64-8.2.0-20190409.tar.xz -C /opt
159  cd projects/hello_world
160  python3 project.py menuconfig
161  python3 project.py build
162  python3 project.py flash -B dan -b 1500000 -p /dev/ttyUSB0 -t
163  ```
164