极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 13070|回复: 5

关于arduino和yeelink的程序问题?再问

[复制链接]
发表于 2015-4-9 17:18:50 | 显示全部楼层 |阅读模式

看过yeelink有关程序,多个传感器采集数据时,最后一行是
// This method calculates the number of digits in the
// sensor reading.  Since each digit of the ASCII decimal
// representation is a byte, the number of digits equals
// the number of bytes:
int getLength(int someValue) {
  // there's at least one byte:
  int digits = 1;
  // continually divide the value by ten,
  // adding one to the digit count for each
  // time you divide, until you're at 0:
  int dividend = someValue /10;
  while (dividend > 0) {
    dividend = dividend /10;
    digits++;
  }
  // return the number of digits:
  return digits;
}
对于这个注释,理解不是很明白,digits = 1跟传感器数量有关系吗?如果是四个传感器,是不是digits为4呢,我要实现四个传感器采集的数据上传至yeelink用户中心,请大家解答一下,我想听听你们的看法
回复

使用道具 举报

发表于 2015-4-9 19:12:24 | 显示全部楼层
这段程序作用是将传感器读到的数值转化成字符,同时计算出几位数。和传感器数量无关。每个传感器送出的数值都要在这里转换,因为yeelink接收字符串
回复 支持 反对

使用道具 举报

 楼主| 发表于 2015-4-9 20:47:49 | 显示全部楼层
林定祥 发表于 2015-4-9 19:12
这段程序作用是将传感器读到的数值转化成字符,同时计算出几位数。和传感器数量无关。每个传感器送出的数值 ...

                  谢谢指点
回复 支持 反对

使用道具 举报

发表于 2015-4-10 11:52:18 | 显示全部楼层
楼主已经实现将数据上传到yeelink了吗?我也在做这个,能否分享一下经验
回复 支持 反对

使用道具 举报

 楼主| 发表于 2015-4-10 14:27:55 | 显示全部楼层
hgmyaoming 发表于 2015-4-10 11:52
楼主已经实现将数据上传到yeelink了吗?我也在做这个,能否分享一下经验

你是做什么?我现在是将多个传感器数据上传遇到点问题
回复 支持 反对

使用道具 举报

发表于 2015-4-15 21:37:38 | 显示全部楼层
请问楼主是上传哪些传感器的数据,我在上传PPD42NS数据时遇到了问题,能否帮忙指点下,我的帖子链接是http://www.geek-workshop.com/thread-14580-1-1.html
回复 支持 反对

使用道具 举报

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

本版积分规则

Archiver|联系我们|极客工坊

GMT+8, 2026-6-19 02:00 , Processed in 0.037959 second(s), 20 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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