|
現今忙碌的都市住宅擁有一扇窗戶是奢侈的,人們在逼不得已的情況之下對於陽光的渴望卻不曾消逝。所以在沒有對外窗的房間,儘管終日未受陽光洗禮,但關燈的剎那,可透過本作品百葉窗篩落而下的光影,感受到日光的美好。在室內空間明亮的狀態下,裝置中日光燈管並不會點亮,但是會有一顆超亮白光LED模擬北極星在窗戶中做閃爍。作品運作方式為自動感測房間中的燈光明案程度來自動啟動虛擬的日光,或是透過無線網路連接裝置本體以往業的方式來開啟或關閉。
互動方式:
妳可以使用你的智慧型手機(iPhone, HTC Magic Hero等)連接上無線網路後,經由網頁中的按鈕控制窗戶的燈光啟動模式(開跟關或經由光敏電阻的自動模式)。

SmallWebServer SourceCode:::
#include "Ethernet.h"
#include "WebServer.h"
static uint8_t mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
static uint8_t ip[] = { 10, 10, 13, 13 };
#define PREFIX "/buzz"
WebServer webserver(PREFIX, 80);
#define RELAY_PIN 2
#define STAR_PIN 3
#define ANALOG_PIN 5;
int cmdStatus = 2;
char toggle = 0;
void buzzCmd(WebServer &server, WebServer::ConnectionType type, char *url_tail, bool tail_complete)
{
if (type == WebServer::POST)
{
bool repeat;
char name[16], value[16];
do
{
repeat = server.readPOSTparam(name, 16, value, 16);
if (strcmp(name, "buzz") == 0)
{
cmdStatus = strtoul(value, NULL, 10);
}
} while (repeat);
server.httpSeeOther(PREFIX);
return;
}
server.httpSuccess();
if (type == WebServer::GET)
{
P(message) =
"<html><head><title>DECADE Product - Window</title>"
"<body>"
"<h1>DECADE Product - Window</h1>"
"<form action='/buzz' method='POST'>"
"<p><button name='buzz' value='0'>Turn it Off!</button></p>"
"<p><button name='buzz' value='1'>Turn it On!</button></p>"
"<p><button name='buzz' value='2'>Auto Mode</button></p>"
"</form></body></html>";
server.printP(message);
}
}
void setup()
{
pinMode(RELAY_PIN, OUTPUT);
Ethernet.begin(mac, ip);
webserver.setDefaultCommand(&buzzCmd);
webserver.begin();
}
void loop()
{
webserver.processConnection();
setStatus();
}
void changeStatus(){
if(cmdStatus==2){
cmdStatus=0; // off
}else if(cmdStatus==0){
cmdStatus=1; // on
}else if(cmdStatus==1){
cmdStatus=2; // auto by sensor
}
}
void setStatus(){
if(cmdStatus==0)
digitalWrite(RELAY_PIN, LOW);
else if(cmdStatus==1)
digitalWrite(RELAY_PIN, HIGH);
else {
if ( analogRead(ANALOG_PIN) > 555){
digitalWrite(RELAY_PIN, HIGH);
}else{
digitalWrite(RELAY_PIN, LOW);
}
}
}
|