智能家居初步实现--手机或PC机通过2440的boa服务器控制zigbee



       第一步 移植boa服务器到2440,在上一篇文章已经描述过。

       第二步  2440通过串口连接CC2530 ,2440一共有3个串口,dev/tts/0(1,2)其中串口0是RS232电平的,串口1,2只有TTL电平,串口0要用作终端控制,所以选择串口2作为串口输出,通过一个转换芯片把TTL连接到CC2530的RS232接口上。修改mini2440的串口程序,使程序每执行一次,则发出一个字母‘a’,mini2440 串口程序如下


# include <stdio.h>
# include <stdlib.h>
# include <termio.h>
# include <unistd.h>
# include <fcntl.h>
# include <getopt.h>
# include <time.h>
# include <errno.h>
# include <string.h>





int main(int argc, char **argv)
{
    int CommFd, TtyFd;


    struct termios TtyAttr;
    struct termios BackupTtyAttr;


    int DeviceSpeed = B115200;
    int TtySpeed = B115200;
    int ByteBits = CS8;
    const char *DeviceName = "/dev/ttyS0";
    const char *TtyName = "/dev/tty";
    int OutputHex = 0;
    int OutputToStdout = 0;
    int UseColor = 0;


    opterr = 0;
printf("Content-type: text/html\n\n");
   printf("<TITLE>Mult Result</TITLE>");
    printf("<H3>Mult Result</H3>");
            DeviceName = 
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值