极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 9877|回复: 0

arduino 串口wifi模块 与flash scoket 通信,无法读到字节长度,

[复制链接]
发表于 2014-3-16 12:19:55 | 显示全部楼层 |阅读模式
http://hi.baidu.com/qykings/item/c536773f4f51b4f2a9842817

#include "string.h"

void setup()
{
  Serial.begin( 115200 );
  Serial.println( "115200" );

}

void loop()
{
  while ( Serial.available() >0 )
  {
    int msgtype = Serial.read();
    char* str="start";
   
    Serial.println( sizeof(str) );
   
   
    Serial.write( sizeof( str ) );
    Serial.write( str );
   
   // Serial.println( str );
}
}





flash================
(代码都是放在oschina的git kingsaslib)

private function readResponse():void
{
while (sockets.bytesAvailable >= 4)
{
if (_headLen <= 0)
{
_headLen=sockets.readInt();
}

//包不够,返回继续等待
if (sockets.bytesAvailable < _headLen)
{
return;
}
var data:ByteArray=new ByteArray();
//         data.clear();
sockets.readBytes(data, 0, _headLen);
_headLen=0;
parse(data);
}

}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|联系我们|极客工坊

GMT+8, 2026-6-5 15:13 , Processed in 0.037691 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表