반응형
XivelyClientString_temperature.zip
APIKEY , FEEDID, USERAGENT 는 1-3에서 설명할께요~~이번 차트에는 그냥 이런게 있다고 알고 넘어가지면 됩니다.
ip의 경우 초기값을 세팅해주고, 나중에 DHCP Server로부터 할당을 받으면 ip주소가 변경되며, 그렇지 않을 경우에는 default ip를 사용하게 되요~
#define APIKEY "YfqMfUI4h9QIZ0dL8JQTpqfhIfaeXwGOc7qrpPeoFHecVPEI" // replace your Xively api key here #define FEEDID 863324820 // replace your feed ID #define USERAGENT "make fair" // user agent is the project name #define ledPin 8 #define sonicPin 7 #define tempPin 6 // assign a MAC address for the ethernet controller. // fill in your address here: byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; // fill in an available IP address on your network here, // for manual configuration: IPAddress ip(192, 168, 122, 5); // initialize the library instance: EthernetClient client; // if you don't want to use DNS (and reduce your sketch size) // use the numeric IP instead of the name for the server: //IPAddress server(216,52,233,121); // numeric IP for api.xively.com char server[] = "api.xively.com"; // name address for xively API
아래의 함수는 초음파센서 값을 cm/inch로 변경해주는 함수예요~^^
long cmtomicro(long a){ return a/29/2; } long inchtomicro(long b){ return b/74/2; }
아래의 내용은 초음파센서의 값이 10cm이하일경우 LED에 불이 들어오게 하는 부분입니다. String dataString = "Ultra," 와 dataString += "\nTemperature, " 의 경우에는 xively에 만들어놓은 channel이름과 동일해야합니다. (아래 그림 참조)
int ultra_sensorReading= cmtomicro(sonicval); // cm거리계산 if(ultra_sensorReading<=10){ digitalWrite(ledPin, HIGH); } String dataString = "Ultra,"; dataString += ultra_sensorReading; int sensor_val = DHT.read(tempPin); int temp_SensorReading= DHT.temperature; dataString += "\nTemperature, "; dataString += temp_SensorReading; sendData(dataString);
자세한 소스는 첨부파일을 확인해주세요~^^
반응형
'Development > WIZnet' 카테고리의 다른 글
The temperture monitering using Exosite Cloud (0) | 2014.11.24 |
---|---|
[arduino]WIZ550io + 온도/초음파센서를 xively에서 모니터링[1-1] - Fritzing (0) | 2014.09.18 |
[arduino]WIZ550io + 온도/초음파센서를 xively에서 모니터링[1-3] - xively사용 (0) | 2014.09.15 |
Python Script for WIZ107SR (0) | 2014.08.18 |
[네트워크]Wake On Lan (0) | 2012.12.28 |