double fahrenheit(double celsius)
//攝氏溫度度轉化為華氏溫度
double kelvin(double celsius)
//攝氏溫度轉化為開氏溫度
// **(點在此溫度時,空氣飽和並產生露珠)
// 參考: [url=
double dewpoint(double celsius, double humidity)
// 快速計算**,速度是5倍dewpoint()
// 參考: [url=
double dewpointfast(double celsius, double humidity)
#include #include #include #include #include #include #include servo myservo;
servo myservo1;
int pir_sensor = a5; //指定pir模擬埠 a5
int led = 13; //指定led埠 13
int val = 0; //儲存獲取到的pir數值
int d = 3;
const int pin = a0;//接紅外介面
irrecv hw(pin);//宣告乙個irrecv型別的物件,並接到pin,也就是11腳
decode_results results;//宣告乙個decode_results型別的物件results,存放紅外置收的訊號解碼結果
extern uint8_t smallfont;
dht11 dht11;
#define dht11pin 2
softwareserial myserial(a2, a3); // a2 -> rx, a3 -> tx
gizwits mygizwits;
#define key1 6
#define key2 7
#define key1_short_press 1
#define key1_long_press 2
#define key2_short_press 4
#define key2_long_press 8
#define no_key 0
#define key_long_timer 3
unsigned long last_keytime = 0;
unsigned long gokit_time_s(void)
char gokit_key1down(void)
} //until open the key
if ((gokit_time_s() - last_keytime) > key_long_timer)
return 0;
}return 0;
} return 0;
}char gokit_key2down(void)
}if ((gokit_time_s() - last_keytime) > key_long_timer)
return 0;
}return 0;
} return 0;
}char gokit_keydown(void)
/** key_handle
@param none
@return none
*/void key_handle(void)
}/**
serial init , gizwits init
@param none
@return none
*/void setup()
/** wifi status printf
@param none
@return none
*/void wifistatushandle()
if (mygizwits.wifihasbeenset(wifi_airlink))
if (mygizwits.wifihasbeenset(wifi_station))
if (mygizwits.wifihasbeenset(wifi_con_router))
if (mygizwits.wifihasbeenset(wifi_discon_router))
if (mygizwits.wifihasbeenset(wifi_con_m2m))
if (mygizwits.wifihasbeenset(wifi_discon_m2m)) }
/** arduino loop
@param none
@return none
*/void loop()
hw.resume();//接收下乙個紅外訊號}
key_handle();//key handle , network configure
wifistatushandle();//wifi status handle
int chk = dht11.read(dht11pin);
switch (chk)
unsigned long varw_wendu = (float)dht11.temperature ; //add sensor data collection
mygizwits.write(value_wendu, varw_wendu);
unsigned long varw_shidu = (float)dht11.humidity;//add sensor data collection
mygizwits.write(value_shidu, varw_shidu);
unsigned long varw_ren = 0;//add sensor data collection
mygizwits.write(value_ren, varw_ren);
val = analogread(pir_sensor); //讀取a0口的電壓值並賦值到val
varw_ren = analogread(pir_sensor);
if (val > 150)//判斷pir數值是否大於150,
else
bool varr_deng = 0;
if (mygizwits.hasbeenset(event_deng))
else
digitalwrite(8, low);
myservo.write(0);
myserial.println(f("event_deng"));
myserial.println(varr_deng, dec);
} mygizwits.process();
}
電腦開wifi熱點
1 開始 在搜尋欄輸入 cmd 右鍵以 管理員身份執行 3 然後再開啟 網路和共享中心 更改介面卡設定 會發現多了這麼一項 microsoft virtual wifi miniport adapter 4 然後 設定internet連線共享 在 網路連線 視窗中,右鍵單擊已連線到internet的...
WifiManager 實現Wifi快捷開關
wifi快捷快捷開關 獲取wifi狀態 public static boolean iswifienable context context 設定wifi狀態 public static void setwifienable context context,boolean enable 那麼跟gpr...
開AP和連WIFI所需步驟
iperf 關nm!它會出現不知道什麼情況。sudo service network manager stop 重啟之後它有概率忘記自己的ip,要關了再開 sudo ifdown wlan0 sudo ifup wlan0 cd hostapd 2.6 hostapd sudo hostapd ho...