读取dht11,显示到lcd1602显示屏,串口发送到电脑。
cpp展开代码void main(void)
{
    char disp[20];
    char count = 0;
    WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT
    P1DIR = 0Xff;
    P1SEL = 0X00;
    P1SEL2 = 0X00;
    P2DIR = 0Xff;
    P2SEL = 0X00;
    P2SEL2 = 0X00;
    LCD_init();
    LCD_clear_home();
    while (1)
    {
        /* 如果读取到了 并且校验成功 */
        if (receive_init() == 1)
        {
            /* 存入数组 */
            count = 0;
            disp[count++] = ' ';
            disp[count++] = humdh % 100 / 10 + '0';
            disp[count++] = humdh % 10 / 1 + '0';
            disp[count++] = '%';
            disp[count++] = 'R';
            disp[count++] = 'H';
            disp[count++] = ' ';
            disp[count++] = temph % 100 / 10 + '0';
            disp[count++] = temph % 10 / 1 + '0';
            disp[count++] = 'C';
            disp[count++] = 0;
            LCD_goto(0, 0);
            LCD_putstr(disp);
            Print_Str(disp);
            Print_Str("      ----\r\n");
        }
        delay_ms(500);
    }
}
cpp展开代码https://docs.qq.com/sheet/DUEdqZ2lmbmR6UVdU?tab=BB08J2


本文作者:Dong
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 CC BY-NC。本作品采用《知识共享署名-非商业性使用 4.0 国际许可协议》进行许可。您可以在非商业用途下自由转载和修改,但必须注明出处并提供原作者链接。 许可协议。转载请注明出处!