Arduino Home automation

Arduino Home automation

  • 最新版本
  • Uncia Robotics

通过Android手机控制家用电器

关于此应用程序

将此应用与微控制器(Arduino,Raspberry Pi,AVR,ARM等),HC-05蓝牙模块和中继模块配合使用,您可以使用智能手机远程控制家用电器。

阅读文档:http://unciarobotics.com/project/home-automation-project-with-arduino-using-hc-05/

读取通过蓝牙传输的数据的基本Arduino代码如下:

const int relay = 2; //连接继电器的引脚
字符数据//变量以存储数据
void setup(){
Serial.begin(9600); //开始串行通讯
pinMode(继电器,输出); //将继电器引脚作为输出
}

无效循环(){
if(Serial.available()> 0)//如果RX上有数据
{
数据= Serial.read(); //将其保存在变量中
如果(数据=='a')
{digitalWrite(relay,HIGH); //打开灯
Serial.println(“ Light ON”);
}
如果(数据=='b')
{digitalWrite(relay,LOW); //关灯
Serial.println(“ Light OFF”);
}
}
}
}
}

//复制将此代码粘贴到Arduino IDE中,并在Serial Monitor上监视数据。

版本 Arduino Home automation