MPPT 751 15通过VE.Direct连接到Raspberry Pi 3(Android的东西),但数据不可读

问题描述 投票:0回答:1

在缓冲区中,我得到的值无法转换为文本或十六进制,[98 63 65 -128 3 0 -94 ....]

有人知道一些Java / Android阅读示例或结果转换为文本吗?

提前感谢。

while ((count = uart.read(buffer, buffer.length)) > 0) {
            Log.d(TAG, "Read " + count + " bytes from peripheral");
            byte[] lectura=new byte[count];

            for(int i=0;i<count;i++){

                lectura[i]= (buffer[i]);

                Log.w(TAG,lectura[i] + " | " + buffer[i]);

            }
android android-studio raspberry-pi3 android-things
1个回答
1
投票

您不仅需要从Raspberry UART读取原始数据,还需要实现VE.Direct协议(接收和解析整个消息)link1 link2(均来自Solar Controller Hacks and Arduino Integration 文章的链接)。还要检查this official documentationFAQ和类似that的示例。实际上,您需要将类似SerialRead.ino的内容转换为Android Things Java。

UPD:Here也是一个很好的例子(您需要将VEDirect.cpp文件转换为Java)。

© www.soinside.com 2019 - 2024. All rights reserved.