Giter VIP home page Giter VIP logo

maixpy-v1_scripts's Introduction

Scripts for MaixPy ~ have a good time~

Doc of MaixPy: maixpy.sipeed.com

Directory Structure

directory description
application Some complex applications
basic basic micropython usage
board run python code, config your sipeed hardware
hardware hardware API usage demo
machine_vision demo for vision related, including machine vision and AI processing related
modules external modules
multimedia normal multimedia processing, audio video game etc.
network network related

运行在 MaixPy 上的脚本,玩得开心~

MaixPy 文档: maixpy.sipeed.com

另外,国内也可以在gitee上查看,会实时同步, 对脚本有疑问请到github搜索问题或者提问, MaixPy 固件相关问题请到MaixPy issue提问

目录结构

目录 描述
application 一些复杂的应用
basic 基本的 micropython 使用
board 运行 Python 代码,配置你的 sipeed 硬件
hardware 硬件 API 使用例程
machine_vision 视觉处理相关,包括机器视觉以及AI处理
modules 外部外设模块使用, 比如 Grove 模块, sp-mod 模块
multimedia 普通的多媒体功能,比如音频、视频、GUI、游戏等
network 网络相关例程

maixpy-v1_scripts's People

Contributors

708yamaguchi avatar aiwintermuteai avatar alice-space avatar aminove99 avatar azurerubia-guet avatar bitsk avatar captainjackey avatar chenzhongxian avatar chrithon avatar codemee avatar junhuanchen avatar kartben avatar myuanz avatar nature80 avatar neutree avatar noahzhy avatar pepsiofme avatar strfarfar avatar trekmax avatar uniartisan avatar unquaiz avatar usthzhanglu avatar vamoosebbf avatar wonderfullook avatar xelll avatar zepan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

maixpy-v1_scripts's Issues

MaixCube Image reversed

My MaixCube with firmware V0.5.0-62-gd6620f1 shows a left-right reversed image on the built in screen. Where do I find the source code for the built in apps to correct the problem?

NameError: name 'fm' isn't defined

trying to run this code

from Maix import GPIO
fm.register(board_info.LED_B, fm.fpioa.GPIO0)
led_r=GPIO(GPIO.GPIO0,GPIO.OUT)
led_r.value(0)

But it am getting this error. Any help will be highly appreciated. Thanks in advance. I am using MaixGo.

Traceback (most recent call last):
File "", line 2, in
NameError: name 'fm' isn't defined
MicroPython v0.5.0-38-g4c4d5b6 on 2020-04-10; Sipeed_M1 with kendryte-k210

Question about serial communication

I want to make my MaixPy BIT to keep sending some data to PC which was connected using /dev/ttyUSB* with some interval.
But I can not find script or doc for it.
In addition, Is it possible to make connection from MaixPy BIT to PC using micropython?

Thanks in advance!

Self_learning_classifier - Freezes after pressing the Boot button the first time

Hi,

I'm following the instructions here:
https://github.com/sipeed/MaixPy_scripts/blob/master/machine_vision/doc/self_learning_classifier.md

I downloaded the encrypted model on address 0x300000 and flashed the latest firmware.

When I run the demo script it launches, but then after pressing the Boot button the first time, the camera freezes and nothing happens anymore. There is no output on the terminal as well, it just freezes everything.

I'm on a Maixduino

sensor.set_hmirror bugs lead to KPU yolo2 results Coordinates error

sensor.set_hmirror(1)
...
bbox = kpu.run_yolo2(task, img) # Run the detection routine
for i in bbox:
img.draw_rectangle(i.rect())

when running above codes, on the resulting image the horizontal position of rectangle is wrong, it is not mirrored as the "sensor.set_hmirror(1)"

receiving error message : OSError: [Errno 116] ETIMEDOUT

Hi everyone,
I am using a Maixduino board flashed with its latest firmware maixpy_v0.5.0_98_g7ec09ea.bin
I was trying to implement the same code as: https://github.com/sipeed/MaixPy_scripts/blob/master/network/demo_esp32_socket.py
in order to receive an image from the server ( which is Alice.jpg) and display it on my LCD.
while doing so, i get this error message: OSError: [Errno 116] ETIMEDOUT in the line 60: data = sock.recv(4096)
I successfully made a connection on my Wifi by changing the WIFI_SSID and WIFI_PASSWD.

Maixduino demo_send_pic can't sent img compression>40

I'm using the demo_send_pic.py demo and I wanted to send an image compressed quality=80 but I got errors:

esp32_spi_wait_spi_char START_CMD error
esp32_spi_socket_write: get resp error!
[MaixPy] esp32_socket_send | send data failed
[Errno 5] EIO
I tried to modify the server script putting a time.sleep(0.025) in the receive and now I can send a quality 50 compressed image. Why?

No response to keyboard in serial terminal connection to MaixPy

I can connect to my MaixPy via serial cable and I get the MaixPy welcome screen, but it doesn't respond at all to my keystrokes. I'm running minicom on Linux Mint connected to /dev/ttyACM0 at 115200 with hardware and software flow control set to OFF, and the backspace key set to DEL, and Line wrap set to YES. I've tried the USB cable that came with the MaixPy and one of my own USB cables. I also tried using gtkterm instead of minicom. They all do the same thing: I get the MaixPy greeting screen and the MicroPython >>> prompt, but when I hit Enter or Ctrl-C or any other key nothing happens.

Here's what minicom looks like when I connect:

Welcome to minicom 2.7.1

OPTIONS: I18n
Compiled on Aug 13 2017, 15:25:34.
Port /dev/ttyACM0, 20:57:40

Press CTRL-A Z for help on special keys


| \ / | /\ |_ | \ \ / / | _ \ \ \ / /
| \ / | / \ | | \ V / | |) | \ _/ /
| | / | / /\ \ | | > < | / \ /
| | | | / __ \ | | / . \ | | | |
| _ | | _ | /
/ \ _\ |
_| /
/ \ \ || |_|
Official Site:http://www.sipeed.com/
Wiki:http://maixpy.sipeed.com/
[MAIXPY]Pll0:freq:320666666
[MAIXPY]Pll1:freq:159714285
[MAIXPY]Flash:0xc8:0x17
[MAIXPY]:Spiffs Mount successful
[MAIXPY]LCD:init

MicroPython 3b5c45649-dirty on 2018-11-15; Sipeed_M1 with kendryte-k210
Type "help()" for more information.


CTRL-A Z for help | 115200 8N1 | NOR | Minicom 2.7.1 | VT102 | Offline | ttyACM0

Any idea how to fix this? Is something on my MaixPy not set correctly? Minicom over serial works fine with other boards such as my BeagleBone Black (using an FTDI USB-to-serial adapter). Thanks.

can't show fmap

The demo in 2 at https://maixpy.sipeed.com/zh/libs/Maix/kpu.html, that shows the feature map doesn't work.

The error "kpu: can't convet float fmap yet" occurs, no matter how to modify the index and num. The last layer of the network is anti-quantized, however, as far as I understand, the other layers are quantized, and their feature maps should be displayed, but they are not.

How do I modify this demo to make it work?

put 2 model to sipeed

Hi,

I want to use 2 model, ex 1MB vs 3 MB, how can I put it to sipeed and read it

Thanks

No module named cpufreq

hey, I noticed when I tried to change/check the cpu/kpu frequency that the cpufreq module doesn't seems to be working, I installed the maixpy_v0.3.2_full version, I don't think I have made anything wrong. Hope this problem will be fixed soon !

import cpufreq Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: no module named 'cpufreq'

ValueError: b>>>init i2c2

I burned my model at 0x500000 address, after burned erase _ spiffs.kfpkg and maixpy_ v0.4.0_ 50_ Gcafae9d.bin. Then the code runs to the "kpu.load(0x500000)" the following error was reported. I tried another address (there is no model on the address), and the same error was reported too.
board : Maix Go

QQ图片20200609154215

kpu.forward OS Error

Hello,

I'm trying to run the following code :

import sensor
import image
import lcd
import KPU as kpu

lcd.init()
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.run(1)
task = kpu.load(0x300000) # you face model in flash at address 0x300000
print("Done")
img = sensor.snapshot()

a = kpu.forward(task, img,1)  #<--- this is the problematic line

print("OK")

However, MaixPy IDE return the message "OS ERROR".
What could be the problem? How can I solve it?

Thank you for your help!

after powering and the boot.py procedure how to execute a program?

just as the title says, I just do not find a how to after the boot procedure execute a program, (in this case a simple menu in which you can select to run a file ("the mythical user defined script") with the:
////////////////(yes it should be # but....)
with open("/sd/SCRIPTS/"+cadena[x]) as f:
exec(f.read())
///////////////
my boot.py file:
import image, time, lcd #uos , sensor, ujson,
from Maix import GPIO
from machine import Timer
print("ESTAS en:")
os.getcwd()
print("que tiene:")
os.listdir()
print("en SCRIPTS hay:")
os.listdir('/sd/SCRIPTS')
print("en IMGS hay:")
os.listdir('/sd/IMGS')
time.sleep(0.1)
#Tim=Timer(Timer.TIMER0, Timer.CHANNEL0, mode=Timer.MODE_PERIODIC, period=1, unit=Timer.UNIT_MS, callback=on_timer, arg=on_timer, start=False, priority=1, div=0)
lcd.init(freq=680000, color=0x0000)
time.sleep(0.3)
relog=time.clock()
SWATT = image.Image(copy_to_fb=1)
#print(Tim)
#sys.version()
x=0
while x<1:
x=x+1
relog.tick()
SWATT.draw_string(25, 100, "SWATT 2.0", (236,36,255), 4)#, 0, 0, False, 0, 0, 0, 0, 0, 0)
lcd.display(SWATT)#9990 ROSA OBCURO, 0222 VERDE, 0555 verde+ 004;
time.sleep(0.7)
lcd.clear()
SWATT.clear()
SWATT.draw_string(75, 100, "SWATT 2.0", lcd.WHITE, 2)#, 0, 0, False)#, lcd.BLACK)
lcd.display(SWATT)
time.sleep(0.65)
lcd.clear()
SWATT.clear()
#import Main.py
with open('/sd/021menu.py') as f:#this does not works when booting, it works if I use the MaixpyIDE
exec(f.read(),globals())#

MLX90640 i2c example

Hi I was wondering an example could be written for the mlx90640 that reads the data via i2c? I see the example of the one that uses the breakout board with the uart but was wondering if one could be written for the i2c for faster reading of the data.

touchscreen on GO

When I run the touchscreen sample I just get a blank screen and in the terminal I get lines of
0 0 0
0 0 0
If I use the thumbwheel I get
{"w":320, "h":240, "type"="rgb565", "size":153600}
0 0 0.
I noticed in the FFT demo there are alternative pins called out. Might this also be the case for the touchscreen. Do you have any other suggestions. thanks

Custom model for Object Detection

Hi, I'd like to know how to create my own custom object detector model. I tested the "face-detector" with a different tiny YOLOv2 model but it didn't work. Any repo I can check to find more infos?

Thanks!

res = img.find_qrcodes()

Hi, I'm beginning with the MaixPy, and i'm trying to use the script to read QR Codes, but not work, and show the error "res = img.find_qrcodes()"

Capture

error when load model

Hi,
I am just a newbie
I want to run face detection but I get error when I run :

$  task = kpu.load(0x00300000) 

ERROR:

v=596458738, flag=-2096411809, arch=-1955282835, layer len=834782759, mem=-39249
0997, out cnt=-663129117
err: we only support V3 now, get V596458738
[MAIXPY]kpu: kpu_model_get_size error -3Traceback (most recent call last):
File "", line 1, in
ValueError: [MAIXPY]kpu: load error -2

How to burn model to this board
please help me
thanks

couldnt record and play sound on my sipeed m1w

i have been running the code(on maxipy IDE) as given:
from Maix import I2S
from Maix import Audio
from Maix import FFT
from fpioa_manager import *

import time
fm.register (20, fm.fpioa.I2S0_IN_D0)
fm.register (19, fm.fpioa.I2S0_WS)
fm.register (18, fm.fpioa.I2S0_SCLK)
fm.register (34, fm.fpioa.I2S2_OUT_D1)
fm.register (35, fm.fpioa.I2S2_SCLK)
fm.register (33, fm.fpioa.I2S2_WS)

rx = I2S (I2S.DEVICE_0)
rx.channel_config (rx.CHANNEL_0, rx.RECEIVER, align_mode = I2S.STANDARD_MODE)
rx.set_sample_rate (16000)
tx = I2S (I2S.DEVICE_2)
tx.channel_config (tx.CHANNEL_1, tx.TRANSMITTER, align_mode = I2S.RIGHT_JUSTIFYING_MODE)
tx.set_sample_rate (16000)

while True:
audio = rx.record (256)
audio_data = audio.to_bytes ()
play_audio = Audio (audio_data)
tx.play (play_audio)

i couldnt play and record the sound on my sipeed m1w .
may i know why ?

Issue running demo_net_socket.py script

File "", line 1, in
File "/flash/demo_net_socket.py", line 10, in
AttributeError: type object 'board_info' has no attribute 'WIFI_RX'

Getting the above error.
Running the demo script 'demo_net_socket.py ' I have changed the nic,connect() with my own wifi ssid and password.

Any help here would be appreciated

creating data of Spectrogram

Hi everyone,
i was trying to create a 3d array of data of spectrogram from the FFT module produced by sipeed m1w.
i can create a list of fft amplitude array base on the sample points.
Anyone is doing something similar to my project ? Hope we can share some experience as well.

Maix Dock Wi-Fi

The documentation is horrible to say the least. I am trying to learn how to get the WIFI working and even though I tried the scripts they do not work.

OSError: Get version fail

import network
from Maix import GPIO
from fpioa_manager import fm, board_info

WIFI_SSID = ""
WIFI_PASSWD = "
"

IO map for ESP32 on Maixduino

fm.register(25,fm.fpioa.GPIOHS10)#cs
fm.register(8,fm.fpioa.GPIOHS11)#rst
fm.register(9,fm.fpioa.GPIOHS12)#rdy
fm.register(28,fm.fpioa.GPIOHS13)#mosi
fm.register(26,fm.fpioa.GPIOHS14)#miso
fm.register(27,fm.fpioa.GPIOHS15)#sclk

nic = network.ESP32_SPI(cs=fm.fpioa.GPIOHS10,rst=fm.fpioa.GPIOHS11,rdy=fm.fpioa.GPIOHS12, mosi=fm.fpioa.GPIOHS13,miso=fm.fpioa.GPIOHS14,sclk=fm.fpioa.GPIOHS15)

nic.connect(WIFI_SSID, WIFI_PASSWD)
print(nic.ifconfig())
print(nic.isconnected())
print("ping baidu.com:", nic.ping("baidu.com"), "ms")
nic.disconnect()

But i am getting OSError: Get version fail

SSID and Password is definitely correct.

Traceback (most recent call last):
File "", line 18, in
OSError: Get version fail
MicroPython v0.5.0-38-g4c4d5b6 on 2020-04-10; Sipeed_M1 with kendryte-k210

AttributeError: 'ESP8285' object has no attribute 'scan'

I've tried to run below script at my Sipeed MAix Dan Dock(M1w model).
https://github.com/sipeed/MaixPy_scripts/blob/master/network/demo_wifi_ap_scan.py

but got the following error.

Traceback (most recent call last):
  File "<stdin>", line 36, in <module>
AttributeError: 'ESP8285' object has no attribute 'scan'

What's wrong?

speaker sample

It would be better to have some samples to use the speaker, as Maix Go have a good-looking speaker hardware.

issue with esp32

When i want to run demo esp32_read adc.
I meet a problem with "AttributeError:'module'object has no attribute 'ESP32_SPI'.
I use maixpy_v0.3.2_full.bin

GPIO and pins

While trying to setup a MaixDuino with the GroveShield V2, I am usuccessfully trying to access IO pins, i.e. a button and an LED.
I would expect the LED example code to light the Grove LED on D7, and the button code to yield if the button on D3 is pressed. Both is not the case.

>>> fm.register(board_info.LED_R,fm.fpioa.GPIOHS0,force=True)
1
>>> led_r = GPIO(GPIO.GPIOHS0, GPIO.OUT)
>>> led_r.value()
0
>>> led_r.value(1)
>>> led_r.value()
0

How can I access the digital pins with MaixPy?

cannot play wav

cannot play wav according to samples play_wav.py, error is wav init error. What's problem? thanks!

Maixduino SPI connection

The example of SPI is not communication on maixduino.
https://github.com/sipeed/MaixPy_scripts/blob/master/hardware/demo_spi.py

Maixduino communication is follow,

K210-IO Function ESP32-IO Function
IO25 SPI_CS IO5 SPI_CS
IO26 SPI_MISO IO23 SPI0_MISO
IO27 SPI_SCLK IO18 SPI0_SCLK
IO28 SPI_MOSI IO14 SPI0_MOSI
IO09 GPIO IO25 ESP32_READY
IO08 GPIO Dedicated pin ESP32_EN

fm.register(25,fm.fpioa.SPI1_SS0)#cs
fm.register(28,fm.fpioa.SPI1_D0)#mosi
fm.register(26,fm.fpioa.SPI1_D1)#miso
fm.register(27,fm.fpioa.SPI1_SCLK)#sclk
spi01=SPI(SPI.SPI1,mode=SPI.MODE_MASTER,baudrate=10000000,polarity=0,phase=0,bits=8,firstbit=SPI.MSB,mosi=fm.fpioa.SPI1_D0,miso=fm.fpioa.SPI1_D1,sck=fm.fpioa.SPI1_SCLK,cs0=fm.fpioa.SPI1_SS0)

https://docid81hrs3j1.cloudfront.net/medialibrary/2019/07/Sipeed_Maixduino_Specifications_EN_V1.0.pdf

GPIO IRQ sample error

GPIO IRQ sample (https://github.com/sipeed/MaixPy_scripts/blob/master/hardware/demo_gpio_intr.py) has a wrong signature for the IRQ handler, at least for MaixPy 5

def test_irq(GPIO, pin_num):
    print("key", pin_num)

Gives an error as callback is expected to have one argument only, the GPIO object. Replacing with:

def test_irq(gpio):
    print("key", gpio)

works. However, GPIO module doesn't expose a reader for pin number so one has to compare gpio against the gpio objects. Mabye not ideal in an IRQ handler?

Demo incorrect unregister value

Second last line:

fm.unregister(board_info.LED_R, fm.fpioa.GPIOHS0)

should be green LED - LED_G:

fm.unregister(board_info.LED_G, fm.fpioa.GPIOHS0)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.