티스토리 뷰
Example source code for data logger
#include <SD.h>
#include <Wire.h>
#include "RTClib.h"
#define cSDSelectionPin 10;
RTC_DS1307 RTC;
File hLogFile;
void setup(){
Serial.begin(9600);
Wire.begin();
if(!hRTC.begin()){
Serial.println("RTC is failes");
return;
}
pinMode(cSDSelectionPin, OUTPUT);
if(!SD.begin(cSDSelectionPin)({
Serial.println("Card failed or NOT present");
return;
}
char tFileName[] = "USLOG00.txt";
for(int i=0; i<100; i++){
tFileName[5] = i/10 + '0';
tFileName[6] = i%10 + '0':
if(!SD.exists(tFileName)){
hLogFile = SD.open(tFileName, FILE_WRITE);
break;
}
}
if(!hLogFile){
Serial.print("Could not create a file : ");
Serial.println(tFileName);
}
}
void loop(){
String theTime = h_GetTime();
h_SaveTime(theTime);
}
String h_GetTime(){
DateTime tNow;
tNow = hRTC.Now();
String Rst = "";
Rst = Rst + tNow.day();
return Rst;
}
void h_SaveTime(String theTime){
hLogFile.println(theTime);
}반응형
'HWDesk > HardwareControl' 카테고리의 다른 글
| Starting ESP8266 with Arduino IDE (0) | 2020.02.26 |
|---|---|
| 아두이노를 이용한 ATTiny45 프로그래밍 (0) | 2020.02.26 |
| [Arduino] 아두이노 개요 (0) | 2020.02.24 |
| [Arduino활용9] 정밀한 거리 측정하기 (0) | 2020.02.23 |
| [Arduino활용22] 무선통신 이용하기 (0) | 2020.02.09 |
반응형
250x250
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- DYOV
- Decorator
- BSC
- 전류
- 치매
- 배프
- 절연형
- Innovations&Hurdles
- ServantClock
- 전압
- 둎
- 허들
- image
- 심심풀이
- Video
- 혁신과허들
- 심심풀이치매방지기
- bilient
- Innovation&Hurdles
- Innovations
- 티스토리챌린지
- 빌리언트
- 빌리칠드
- 오블완
- 혁신
- 치매방지
- Hurdles
- BiliChild
- arduino
- 아두이노
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
글 보관함

