ln001_sd 2022-01-09 18:34 采纳率: 33.3%
浏览 8
已结题

求帮助,TPYBoard v702定位出错

TPYBoard v702定位时经纬度都是-0.0000。(定位模块在程序中已开启,开发板屏幕亮起但没有字符)

#main.py
import pyb
import upcd8544
from machine import SPI,Pin
from pyb import UART

leds = [pyb.LED(i) for i in range(1,5)]
SPI = pyb.SPI(1) #DIN=>X8-MOSI/CLK=>X6-SCK
#DIN =>SPI(1).MOSI 'X8' data flow (Master out, Slave in)
#CLK =>SPI(1).SCK  'X6' SPI clock
RST    = pyb.Pin('X20')
CE     = pyb.Pin('X19')
DC     = pyb.Pin('X18')
LIGHT  = pyb.Pin('X17')
lcd_5110 = upcd8544.PCD8544(SPI, RST, CE, DC, LIGHT)
N2 = Pin('Y3', Pin.OUT_PP)
N1 = Pin('Y6', Pin.OUT_PP)
N1.low()
pyb.delay(2000)
N1.high()
pyb.delay(10000)
u2 = UART(4, 115200,timeout=100)

def DataConver(str_,flag):
    wei_=float(str_)/100
    wei_arr=str(wei_).split('.')
    val_=100000
    if flag==0:#纬度
        val_=10000
    wei_arr[1]=str(float(wei_arr[1])/60*val_).replace('.','')
    weidu=wei_arr[0]+'.'+wei_arr[1]
    return weidu
while True:
    pyb.LED(2).on()
    u2.write('AT+GPSLOC=1\r\n')
    pyb.delay(3000)
    _dataRead=u2.read()
    print('搜星=',_dataRead)
    pyb.delay(1000)
    u2.write('AT+GPSLOC=0\r\n')
    pyb.delay(200)
    print('BEIDOU')
    _dataRead=u2.read()
    if _dataRead!=None:
        print('原始数据=',_dataRead)
        print('原始数据长度:',len(_dataRead))
        if 60<len(_dataRead)<70:
            _dataRead = _dataRead.decode('utf-8')
            _dataRead1=_dataRead.split(',')
            print('数据=',_dataRead1)
            print(len(_dataRead1),'***')
            if len(_dataRead1)>4:
#*******************纬度计算********************
                weidu=_dataRead1[1]
                WD=DataConver(weidu,0)
#*******************经度计算********************
                jingdu=_dataRead1[2]
                JD=DataConver(jingdu,1)
                if jingdu.find('0.0000')<0:
                    N2.high()
"""#***********************时间************************
    lcd_5110.lcd_write_string('JINGDU:',0,0)
    lcd_5110.lcd_write_string(str(JD),0,1)
    lcd_5110.lcd_write_string('WEIDU:',0,2)
    lcd_5110.lcd_write_string(str(WD),0,3)"""


img

  • 写回答

0条回答 默认 最新

    报告相同问题?

    问题事件

    • 已结题 (查看结题原因) 1月10日
    • 修改了问题 1月9日
    • 创建了问题 1月9日

    悬赏问题

    • ¥15 springboot aop 应用启动异常
    • ¥15 matlab有关债券凸性久期的代码
    • ¥15 lvgl v8.2定时器提前到来
    • ¥15 qtcp 发送数据时偶尔会遇到发送数据失败?用的MSVC编译器(标签-qt|关键词-tcp)
    • ¥15 cam_lidar_calibration报错
    • ¥15 拓扑学,凸集,紧集。。
    • ¥15 如何扩大AIS数据容量
    • ¥15 单纯型python实现编译报错
    • ¥15 c++2013读写oracle
    • ¥15 c++ gmssl sm2验签demo