Created
December 13, 2015 20:44
-
-
Save dwblair/50319e4dc38aa4bfd0e6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Wire.h> | |
#include <SPI.h> | |
#include <RTClib.h> | |
#include <RTC_DS3231.h> | |
#include<stdlib.h> | |
#include <SD.h> | |
// This code requires that the following library be installed: | |
// Mizraith's RTC library: https://github.com/mizraith/RTClib | |
// it also requires: | |
// -- that a microSD card be placed in the microSD card holder | |
// -- that a coin cell be placed on the board | |
//RTC stuff | |
RTC_DS3231 RTC; | |
//led for output | |
#define led 9 | |
// working flag: 0: not working; 1: working; | |
int workingFlag = 1; // | |
//SD card variables | |
const int chipSelect = 7; | |
int SDpower = 6; | |
void setup() { | |
digitalWrite(led,LOW); // begin in state of 'not working' | |
pinMode(SDpower,OUTPUT); | |
digitalWrite(SDpower,LOW); | |
if (!SD.begin(chipSelect)) { | |
// SD failed or not present | |
workingFlag=0; | |
} | |
// begin I2C protocol (necessary for RTC) | |
Wire.begin(); | |
RTC.begin(); | |
//broadcast that we're working | |
if (workingFlag==1) { | |
for (int j=0;j<200;j++) { | |
digitalWrite(led,HIGH); | |
delay(10); | |
digitalWrite(led,LOW); | |
} | |
} | |
} | |
void loop() {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Diagnostic
Requirements
Procedure:
Diagnostic: