X-Board继电器
X-board继电器(SKU:DFR0222)
目录
1 产品简介
2 技术规格
2.1 继电器规格
3 样例代码
产品简介
网络操做变得如此简单。拥有Xboard继电器,你不仅能通过网络监测数据,也能控制数据。Xboard继电器把Atmega32U4微型处理器和wiz5100芯片结合在一起。wiz5100同Arduino Lendardo和以太网数据库完全兼容,它拥有内嵌Xbee模块和两个继电器,因此能够通过网络感应和控制,操作简易。
不同于之前的X-board,X-board继电器不需要编程适配器,只需一条micro USB线,就能上传程序。
技术规格
MCU:Atmega 32U4
时钟频率:16MHz
闪存:32KB(ATmega32U4),其中4KB用于引导程序
SRAM:2.5KB(ATmega32U4)
以太网芯片:Wiz5100
电源:7.2-12伏
USB:Micro USB@5V
接口:2个模拟输入口,1个I2C接口,4个数字接口
继电器规格
额定电流:10A(NO)5A(NC)
最大合闸电压:150VAC 24VDC
数字接口
控制信号:数字输出
触点容量(Res.Load):10A 277VAC/24VDC
最大合闸电压:250VAC/30VDC 250VAC/30VDC
最大合闸电流:15A
最大合闸电源:2770VA 240W 2770VA 240W
额定电压: 10A 120VAC /10A 277VAC
操作时间(nomi. Vot.): 10ms
释放时间(nomi. Vot.): 5ms
样例代码
/* DFRobot X-board V2 Sample Code
A simple web server with DHPC capbabilty.
1)Get IP address from router automatically
2)Show the value of the analog input pins
created 28 Sep 2012
by Ricky
*/
#include <SPI.h>
#include <Ethernet.h>
EthernetServer server(80);
// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = {
0xDE, 0xCD, 0xAE, 0x0F, 0xFE, 0xED };
// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// no point in carrying on, so do nothing forevermore:
for(;;)
;
}
// print your local IP address:
Serial.print("My IP address: ");
for (byte thisByte = 0; thisByte < 4; thisByte++) {
// print the value of each byte of the IP address:
Serial.print(Ethernet.localIP()[thisByte], DEC);
Serial.print(".");
}
Serial.println();
// start the Ethernet connection and the server:
server.begin();
Serial.print("server is at ");
Serial.println(Ethernet.localIP());
}
void loop() {
// listen for incoming clients
EthernetClient client = server.available();
if (client) {
Serial.println("new client");
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
Serial.write(c);
// if you've gotten to the end of the line (received a newline
// character) and the line is blank, the http request has ended,
// so you can send a reply
if (c == '\n' && currentLineIsBlank) {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connnection: close");
client.println();
client.println("<!DOCTYPE HTML>");
client.println("<html>");
// add a meta refresh tag, so the browser pulls again every 5 seconds:
client.println("<meta http-equiv="refresh" content="5">");
client.println("<link rel="stylesheet" type="text/css" href="http://www.dfrobot.com/ihome/stylesheet/stylesheet.css" />");
client.println("<center> <a href=\"http://www.dfrobot.com\"><img src=\"http://alturl.com/qf6vz\"></a> </center> ");
client.println("<br />");
client.println("<div>");
// output the value of each analog input pin
for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
int sensorReading = analogRead(analogChannel);
client.print("analog input ");
client.print(analogChannel);
client.print(" is ");
client.print(sensorReading);
client.println("<br />");
}
// output the value of each digital input pin
for (int digitalChannel = 2; digitalChannel < 10; digitalChannel++) {
int sensorReading = digitalRead(digitalChannel);
if(digitalChannel!=7&&digitalChannel!=8)
{
client.print("Digital input ");
client.print(digitalChannel);
client.print(" is ");
client.print(sensorReading);
client.println("<br />");
}
else
{
client.print("Relay ");
client.print(digitalChannel);
client.print(" is ");
client.print(sensorReading);
client.println("<br />");
}
}
client.println("</div>");
client.println("</html>");
break;
}
if (c == '\n') {
// you're starting a new line
currentLineIsBlank = true;
}
else if (c != '\r') {
// you've gotten a character on the current line
currentLineIsBlank = false;
}
}
}
// give the web browser time to receive the data
delay(1);
// close the connection:
client.stop();
Serial.println("client disonnected");
}
}
购买 X-board继电器(SKU:DFR0222)