Download presentation
Presentation is loading. Please wait.
Published byWendy Perkins Modified over 9 years ago
1
유비쿼터스 컴퓨팅 및 실습 Final Report I Pig 2조 08 정성혁 08 변상규 08 최종민 08 이희성
09 고현경
2
01. 과제명 02. 과제개요 03. Arduino 적재 프로그램 코드 04. 데이터 관리 및 Viewer
Contents 목차 01. 과제명 02. 과제개요 03. Arduino 적재 프로그램 코드 04. 데이터 관리 및 Viewer 05. 개발 산출물 메뉴얼 06. 개발 기간 및 일정 07. 업무분담 Koreatech Ubiquitous Computing Practice 2
3
I Pig(Intelligent Pig)
과 제 명 One I Pig(Intelligent Pig) intelligent Computing Practice Koreatech Ubiquitous Computing Practice 3
4
과제개요(1) SNS 저금통 Intelligent 저금통 Sensor two
Koreatech Ubiquitous Computing Practice 4
5
과제개요(2) two 100 500 Koreatech Ubiquitous Computing Practice 5 ● 동전구분
● 눈에 led ● 저금통 문 열리기 ● 꼬리 흔들기 ● 저금통 진동 Koreatech Ubiquitous Computing Practice 5
6
프로그램 코드 three Koreatech Ubiquitous Computing Practice 6 프로그램 코드
#include <SPI.h> #include <WiFi.h> #include <EEPROM.h> #define CYCLE_MINUTE 1 #define SUM_ADDRESS 10 char ssid[] = "JJangLab"; char key[] = "emsysjang"; char token[] = " kEW8L7zXKiraIYNuhIIgSK7hm2wWe441yeOWJSA"; char server_adr[] = "arduino-tweet.appspot.com"; unsigned long time = 0; unsigned long m = 60000; int status = WL_IDLE_STATUS; WiFiClient twtclient; String txt =""; int sumcoin=0; int coin=0; int flag=0; int pin1=0; int pin2=1; int pin3=2; int pin4=4; int pin5=7; int pin6=8;//tailmoto int pin9 =9; int pin10=10; 프로그램 코드 Koreatech Ubiquitous Computing Practice 6
7
프로그램 코드 three Koreatech Ubiquitous Computing Practice 7 프로그램 코드
int incoin=0; int timecount=0; int beak=0, oship=0, obeak=0; int coinflag=0; void checktime(); void insertcoin(); void spinTail(); void destroymode(); void sparkEyes(); void setup(void){ Serial.begin(9600); pinMode(pin4,OUTPUT); pinMode(pin5,OUTPUT); pinMode(pin6,OUTPUT); pinMode(pin9,OUTPUT); pinMode(pin10,OUTPUT); digitalWrite(4,LOW); digitalWrite(7,LOW); analogWrite(9,10); analogWrite(10,10); while (!Serial) { } if (WiFi.status() == WL_NO_SHIELD) { Serial.println("WiFi shield not present"); while(true); 프로그램 코드 Koreatech Ubiquitous Computing Practice 7
8
프로그램 코드 three Koreatech Ubiquitous Computing Practice 8 프로그램 코드
void loop(){ checktime(); Serial.print(timecount); Serial.print(" "); Serial.print(incoin); Serial.println(""); if(timecount>=2000 && incoin==0){ destroymode(); } insertcoin(); void checktime(){ timecount++; delay(1); void sparkEyes(){ int value = random(100,300); for(int i=0;i<4;i++){ analogWrite(9,255); delay(value); analogWrite(9,10); analogWrite(10,255); analogWrite(10,10); delay(100); 프로그램 코드 Koreatech Ubiquitous Computing Practice 8
9
프로그램 코드 three Koreatech Ubiquitous Computing Practice 9 프로그램 코드
void insertcoin(){ String temptxt; int read1 = analogRead(pin1); int read2 = analogRead(pin2); int read3 = analogRead(pin3); if(read1<200 && coinflag == 0){ coinflag = 1; Serial.println("50won input"); oship = 1; incoin = 1; timecount=0; coin +=50; spinTail(); } if(read2<200 && coinflag == 0){ coinflag = 1; Serial.println("100won input"); beak=1; incoin = 1; timecount=0; coin +=100; spinTail();} if(read3<200 && coinflag == 0){ coinflag = 1; Serial.println("500won input"); obeak = 1; incoin = 1; timecount=0; coin +=500; spinTail();} if(incoin==1 && timecount>=1000){ //sumcoin=EEPROM.read(SUM_ADDRESS); sumcoin+=coin; //EEPROM.write(SUM_ADDRESS,sumcoin); temptxt=""; temptxt+=coin; temptxt+="W Deposited! Total balance:"; temptxt+=sumcoin; temptxt+="W"; postTwt(temptxt); incoin=0; timecount=0; coin=0; flag=0; } 프로그램 코드 Koreatech Ubiquitous Computing Practice 9
10
프로그램 코드 three Koreatech Ubiquitous Computing Practice 10 프로그램 코드
void spinTail(){ sparkEyes(); digitalWrite(pin6,HIGH); // spin tail delay(2000); digitalWrite(pin6,LOW);// stop spin tail oship = 0; beak = 0; obeak = 0; timecount=0; Serial.println(incoin); coinflag = 0; } void destroymode(){ txt = "I'm hungry give me coin!!!!!"; if(flag == 0){ postTwt(txt); flag = 1; int value = random(100,300); insertcoin(); if(!(incoin)){ digitalWrite(4,HIGH); delay(value); digitalWrite(4,LOW); digitalWrite(7,HIGH); digitalWrite(7,LOW); 프로그램 코드 Koreatech Ubiquitous Computing Practice 10
11
프로그램 코드 three Koreatech Ubiquitous Computing Practice 11 프로그램 코드
void printWifiStatus() { // print the SSID of the network you're attached to: Serial.print("SSID: "); Serial.println(WiFi.SSID()); // print your WiFi shield's IP address: IPAddress ip = WiFi.localIP(); Serial.print("IP Address: "); Serial.println(ip); // print the received signal strength: long rssi = WiFi.RSSI(); Serial.print("signal strength (RSSI):"); Serial.print(rssi); Serial.println(" dBm"); } void postTwt(String tweet) { Serial.print("tweet: "); Serial.println(tweet); if (twtclient.connect(server_adr, 80)) { Serial.println("connected"); twtclient.println("POST HTTP/1.0"); twtclient.print("Content-Length: "); twtclient.println(tweet.length()+strlen(token)+14); twtclient.println(); twtclient.print("token="); twtclient.print(token); twtclient.print("&status="); twtclient.println(tweet); 프로그램 코드 Koreatech Ubiquitous Computing Practice 11
12
프로그램 코드 three Koreatech Ubiquitous Computing Practice 12 프로그램 코드
// if the server's disconnected, stop the twtclient: if (!twtclient.connected()) { Serial.println(); Serial.println("disconnecting from server."); twtclient.stop(); // do nothing forevermore: while(true); } Serial.println("twt finished"); 프로그램 코드 Koreatech Ubiquitous Computing Practice 12
13
Viewer four Koreatech Ubiquitous Computing Practice 13
14
Viewer four Koreatech Ubiquitous Computing Practice 14
15
Viewer four Koreatech Ubiquitous Computing Practice 15
16
개발 산출물 메뉴얼 five I Pig I’m hungry give me coin 설정 시간에 저금 하지 않음
Koreatech Ubiquitous Computing Practice 16
17
개발 산출물 메뉴얼 five 동전 입력 500 100 진동 중단 LED 켬
Koreatech Ubiquitous Computing Practice 17
18
개발 산출물 메뉴얼 five 적외선 Sensor 500 동전 입력 50 100 50 100 500
Koreatech Ubiquitous Computing Practice 18
19
개발 산출물 메뉴얼 five 동전 입력 완료 500 100 동전 판별
Koreatech Ubiquitous Computing Practice 19
20
개발 산출물 메뉴얼 five I Pig 100\ deposited Total money : 5200 \ 동전 입력 완료
Koreatech Ubiquitous Computing Practice 20
21
개발기간 및 일정 six Koreatech Ubiquitous Computing Practice 21
5월 3주차 5월 4주차 5월 5주차 6월 1주차 6월 2주차 아이디어 및 주제선정 회의 하드웨어 개발 SNS 관련 API 연구 소프트웨어 개발 저금통과 아두이노의 연결 수정 및 보수 최종 발표 준비 Koreatech Ubiquitous Computing Practice 21
22
업무분담 seven 상규 기존 Coretex 마이크로프로세서를 네트워크 기반 SNS를 이용하여 프로그래밍하였더니 신기하였다.
종민 기존의 마이크로프로세서를 이용하는 것보다 간단하게 하드웨어를 구성할 수 있다는 점이 흥미로웠다. 희성 새로운 하드웨어를 접해보고 거기에 기능들을 여러가지 구현해보는게 굉장히 재미있었다. 성혁 아두이노를 처음 만져 봐서 재밌었고 앞으로 취미로 이용학 싶다는 생각을 하였습니다.처음 목표했던 기능을 모두 구현하지 못해 많이 아쉬웠고.안식년 가시기 전에 좋은 수업 감사합니다.~~~ 현경 아두이노가 오픈소스하드웨어라곤 했지만 안드로이드처럼 많은 소스를 찾기 힘들었다. 아두이노를 공부해서 내가 만든 소스를 공유해야겠다. Koreatech Ubiquitous Computing Practice 22
23
Q & A Koreatech Ubiquitous Computing Practice 23 Koreatech Ubiquitous
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.