logo

搞不懂的语法错误

2019-02-04 17:00
6
ylvc
de626801-0a57-4c6c-a1d8-b7c54704e5ee.png
#main.py
# Untitled - By: Lee - 周六 1月 26 2019
# 收开始命令 扫码  找色块 测距 发距离
import sensor, image, time
from pyb import UART
import json
from sending import recive_data()
from sending import sending_data()
from Sao_Ma
import Measure

sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000)
clock = time.clock()
uart = UART(3, 19200)

while True:
    order = recive_data()
    if order == 1:              #开始执行命令
        fan_kui = ma()          #扫码
        uart.write(fan_kui)     #反馈扫码的数字(整数)
        time.sleep(1000)
        N = recive_data()
        if N == 1:
            L = measure_distance(N)
            uart.write(L)       #返回距离大小
        elif N == 2:
            L = measure_distance(N)
            uart.write(L)
            if N == 3:
                L = measure_distance(N)
                uart.write(L)
#seending.py
import time
from pyb import UART

uart = UART(3, 115200)
uart.init(115200, bits=8, parity=None, stop=1) # init with given parameters


def sending_data(jj):
    global uart
    j = jj
    uart.write('j')     #反馈字符串

def recive_data():
    global uart
    tmp_data = 1
    if uart.any():
        tmp_data = uart.readline()
        uart.write("RECIVED : %s\n"%tmp_data)
        print(tmp_data)        
    return tmp_data

#while(True):
#    sending_data(1)
#    recive_data()
#    time.sleep(1000)
2019-02-05 17:01
I
网红小智智 星瞳科技

from import 不需要加括号()

https://cn.bing.com/search?q=python3%E6%95%99%E7%A8%8B%20from%20import&qs=n&form=QBRE&sp=-1&pq=python3%E6%95%99%E7%A8%8B%20from%20import&sc=0-21&sk=&cvid=7EBB0527C9C04E188B01C9C77ABCB6E8

2019-02-06 17:05
6
ylvc

@kidswong999 谢谢小智智:grinning_face: