亅亅斗地主官方网站合集 网乐联不上

【求教】arduino+乐联,上传的数据为0是什么原因呢求教_arduino吧_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:42,353贴子:
【求教】arduino+乐联,上传的数据为0是什么原因呢求教收藏
以下时代码部分#include &Wire.h&//#include &WCLHPM25.h&#include &WCLHPM25.h&#include &SoftwareSerial.h&SoftwareSerial mySerial(10, 11); // RX, TX/*Test on Uno R3.M3C
UnoR3TX &---& 0(Rx)*/
static unsigned char ucRxBuffer[250];
static unsigned char ucRxCnt = 0;
pmcf100=0;
pmat100=0;
pmcount03=0;
pmcount05=0;
pmcount10=0;
pmcount25=0;
pmcount50=0;
pmcount100=0;
double Fahrenheit(double celsius) {
return 1.8 * celsius + 32;}
//摄氏温度度转化为华氏温度double Kelvin(double celsius){
return celsius + 273.15;}
//摄氏温度转化为开nmnm氏温度// 露点(点在此温度时,空气饱和并产生露珠)// 参考: double dewPoint(double celsius, double humidity){
double A0= 373.15/(273.15 + celsius);
double SUM = -7.90298 * (A0-1);
SUM += 5.02808 * log10(A0);
SUM += -1.3816e-7 * (pow(10, (11.344*(1-1/A0)))-1) ;
SUM += 8.1328e-3 * (pow(10,(-3.49149*(A0-1)))-1) ;
SUM += log10();
double VP = pow(10, SUM-3) *
double T = log(VP/0.61078);
// temp var
return (241.88 * T) / (17.558-T);}// 快速计算露点,速度是5倍dewPoint()// 参考: double dewPointFast(double celsius, double humidity){
double a = 17.271;
double b = 237.7;
double temp = (a * celsius) / (b + celsius) + log(humidity/100);
double Td = (b * temp) / (a - temp);
return Td;}#include &dht11.h&dht11 DHT11;#define DHT11PIN 8#include &LeweiClient.h&#include &SPI.h&#include &Ethernet.h&#define LW_USERKEY &fddad53ad4a&#define LW_GATEWAY &01&//delay between updates#define POST_INTERVAL (10*1000)//IPAddress ip(192,168,31,115);//IPAddress mydns(192,168,31,1);//IPAddress gw(192,168,31,1);//IPAddress subnet(255,255,255,0);LeWeiClient *void setup() {
// start serial port:
Serial.begin(9600);
mySerial.begin(9600);
Serial.println(&DHT11 TEST PROGRAM &);
Serial.print(&LIBRARY VERSION: &);
Serial.println(DHT11LIB_VERSION);
Serial.println();
Serial.begin(9600);
// hope no exception here
lwc = new LeWeiClient(LW_USERKEY, LW_GATEWAY);
//lwc = new LeWeiClient(LW_USERKEY, LW_GATEWAY,ip,mydns,gw,subnet);}void loop() {
// read the analog sensor:
//int sensorReading = analogRead(A0);
// if there's incoming data from the net connection.
// send it out the serial port.
This is for debugging
// purposes only:
if (lwc) {
Serial.print(&*** start data collection &);
//t1,t2.. must using the same name setting on web server.
lwc-&append(&t1&,(float)(pmcf25));
lwc-&append(&t2&,(float)(pmcf10));
Serial.print(&*** data send ***&);
lwc-&send();
//Grammar changed by Wei&A)
Serial.print(&*** send completed ***&);
delay(POST_INTERVAL);
Serial.println(&\n&);
int chk = DHT11.read(DHT11PIN);
Serial.print(&Read sensor: &);
switch (chk)
case DHTLIB_OK:
Serial.println(&OK&);
case DHTLIB_ERROR_CHECKSUM:
Serial.println(&Checksum error&);
case DHTLIB_ERROR_TIMEOUT:
Serial.println(&Time out error&);
Serial.println(&Unknown error&);
Serial.print(&Humidity (%): &);
Serial.println((float)DHT11.humidity, 2);
Serial.print(&Temperature (oC): &);
Serial.println((float)DHT11.temperature, 2);
Serial.print(&Temperature (oF): &);
Serial.println(Fahrenheit(DHT11.temperature), 2);
Serial.print(&Temperature (K): &);
Serial.println(Kelvin(DHT11.temperature), 2);
Serial.print(&Dew Point (oC): &);
Serial.println(dewPoint(DHT11.temperature, DHT11.humidity));
Serial.print(&Dew PointFast (oC): &);
Serial.println(dewPointFast(DHT11.temperature, DHT11.humidity));
delay(2000);
//print received data. Data was received in serialE
while (mySerial.available())
CopeSerialData(mySerial.read());
Serial.println(&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&);
delay(3000);}char CopeSerialData(unsigned char ucData){
static unsigned char ucRxBuffer[250];
static unsigned char ucRxCnt = 0;
pmcf100=0;
pmat100=0;
pmcount03=0;
pmcount05=0;
pmcount10=0;
pmcount25=0;
pmcount50=0;
pmcount100=0;
ucRxBuffer[ucRxCnt++]=ucD
if (ucRxBuffer[0]!=0x42&&ucRxBuffer[1]!=0x4D)
ucRxCnt=0;
return ucRxC
if (ucRxCnt&32) {return ucRxC}
for (int i=0;i&32;i++)
{Serial.print(ucRxBuffer);Serial.print(&
Serial.println(&&);
pmcf10=(float)ucRxBuffer[4]*256+(float)ucRxBuffer[5];Serial.print(&PM1.0_CF1:&);Serial.print(pmcf10);Serial.print(&
pmcf25=(float)ucRxBuffer[6]*256+(float)ucRxBuffer[7];Serial.print(&PM2.5_CF1:&);Serial.print(pmcf25);Serial.print(&
pmcf100=(float)ucRxBuffer[8]*256+(float)ucRxBuffer[9];Serial.print(&PM10_CF1:&);Serial.print(pmcf100);Serial.println(&
pmat10=(float)ucRxBuffer[10]*256+(float)ucRxBuffer[11];
Serial.print(&PM1.0_AT:&);Serial.print(pmat10);Serial.print(&
pmat25=(float)ucRxBuffer[12]*256+(float)ucRxBuffer[13];
Serial.print(&PM2.5_AT:&);Serial.print(pmat25);Serial.print(&
pmat100=(float)ucRxBuffer[14]*256+(float)ucRxBuffer[15];
Serial.print(&PM10_AT:&);Serial.print(pmat100);Serial.println(&
pmcount03=(float)ucRxBuffer[16]*256+(float)ucRxBuffer[17];
Serial.print(&PMcount0.3:&);Serial.print(pmcount03);Serial.print(&
pmcount05=(float)ucRxBuffer[18]*256+(float)ucRxBuffer[19];
Serial.print(&PMcount0.5:&);Serial.print(pmcount05);Serial.print(&
pmcount10=(float)ucRxBuffer[20]*256+(float)ucRxBuffer[21];
Serial.print(&PMcount1.0:&);Serial.print(pmcount10);Serial.println(&
pmcount25=(float)ucRxBuffer[22]*256+(float)ucRxBuffer[23];
Serial.print(&PMcount2.5:&);Serial.print(pmcount25);Serial.print(&
pmcount50=(float)ucRxBuffer[24]*256+(float)ucRxBuffer[25];
Serial.print(&PMcount5.0:&);Serial.print(pmcount50);Serial.print(&
pmcount100=(float)ucRxBuffer[26]*256+(float)ucRxBuffer[27];
Serial.print(&PMcount10:&);Serial.print(pmcount100);Serial.println(&
&);Serial.println(& *****************************************************************
&);Serial.println(&
ucRxCnt=0;
return ucRxC
}}===我是分割线================下面是监视运行情况=======求教了T11 TEST PROGRAM LIBRARY VERSION: 0.4.1Ethernet configuration OK*** start data collection append:{&Name&:&t1&,&Value&:&0.00&},append:{&Name&:&t2&,&Value&:&0.00&},*** data send ***data:[{&Name&:&t1&,&Value&:&0.00&},{&Name&:&t2&,&Value&:&0.00&},]*** send completed ***Read sensor: OKHumidity (%): 61.00Temperature (oC): 11.00Temperature (oF): 51.80Temperature (K): 284.15Dew Point (oC): 3.78Dew PointFast (oC): 3.7766
PM1.0_CF1:133
PM2.5_CF1:236
PM10_CF1:241
PM1.0_AT:87
PM2.5_AT:155
PM10_AT:159
PMcount0.3:11481
PMcount0.5:3827
PMcount1.0:985
PMcount2.5:20
PMcount5.0:2
PMcount10:2
*****************************************************************
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*** start data collection append:{&Name&:&t1&,&Value&:&0.00&},append:{&Name&:&t2&,&Value&:&0.00&},*** data send ***data:[{&Name&:&t1&,&Value&:&0.00&},{&Name&:&t2&,&Value&:&0.00&},]*** send completed ***Read sensor: OKHumidity (%): 63.00Temperature (oC): 11.00Temperature (oF): 51.80Temperature (K): 284.15Dew Point (oC): 4.24Dew PointFast (oC): 4.23@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*** start data collection append:{&Name&:&t1&,&Value&:&0.00&},append:{&Name&:&t2&,&Value&:&0.00&},*** data send ***data:[{&Name&:&t1&,&Value&:&0.00&},{&Name&:&t2&,&Value&:&0.00&},]*** send completed ***Read sensor: OKHumidity (%): 61.00Temperature (oC): 11.00Temperature (oF): 51.80Temperature (K): 284.15Dew Point (oC): 3.78Dew PointFast (oC): 3.77
登录百度帐号推荐应用
为兴趣而生,贴吧更懂你。或}

我要回帖

更多关于 斗地主手机版 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信