You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.2 KiB
62 lines
1.2 KiB
void data()
|
|
{
|
|
//char test_data[] = "test3,3v";
|
|
//char test_data[] = "t133v+103c299h95s";
|
|
// vc-напряжение на батарее - целая часть
|
|
// vd-напряжение на батарее - дробная часть
|
|
//u=vc*10+vd
|
|
|
|
int u=vc*100+vd;
|
|
//tc=25 температура ds1802- целая часть
|
|
//td=3 температура ds1802- дробная часть
|
|
int t=tc*10+td;
|
|
//zn; знак 0+ 1- температура ds1802
|
|
int h=hc*10+hd;
|
|
//hc=75;влажность dh22- целая часть
|
|
//hd=6;влажность dh22- дробная часть
|
|
//s=56; освещенность
|
|
char u1[4];
|
|
char t1[4];
|
|
char h1[4];
|
|
char s1[4];
|
|
|
|
if (u<100)
|
|
{sprintf (u1,"0%d",u);
|
|
}
|
|
else
|
|
{sprintf(u1,"%d",u);
|
|
}
|
|
|
|
if (s<10)
|
|
{sprintf (s1,"0%d",s);
|
|
}
|
|
else
|
|
{sprintf(s1,"%d",s);
|
|
}
|
|
|
|
if (t<100)
|
|
{sprintf(t1,"0%d",t);
|
|
if (t<10){sprintf(t1,"00%d",t);}
|
|
}
|
|
else
|
|
{sprintf(t1,"%d",t);
|
|
}
|
|
|
|
if (h<100)
|
|
{sprintf(h1,"0%d",h);
|
|
if (h<10){sprintf(h1,"00%d",h);}
|
|
}
|
|
else
|
|
{sprintf(h1,"%d",h);
|
|
}
|
|
|
|
if (zn==0)
|
|
{sprintf (test_data, "t1-%sc%sv%sh%s",t1,u1,h1,s1);//"t1+103c33v299h95s";
|
|
}
|
|
else
|
|
{sprintf (test_data, "t1+%sc%sv%sh%s",t1,u1,h1,s1);
|
|
}
|
|
|
|
//sprintf (test_data, "t1%sv%st%ss%st", v1,t2,s3,s4);
|
|
}
|
|
|
|
|