Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: SCP1000Example 0sample_SCP1000_USB SCP1000_Fastsensing
Diff: main.cpp
- Revision:
- 1:0bc094c5d1b9
- Parent:
- 0:23fab9b42ad4
- Child:
- 2:4c2784b363ad
diff -r 23fab9b42ad4 -r 0bc094c5d1b9 main.cpp
--- a/main.cpp Wed Feb 02 08:00:23 2011 +0000
+++ b/main.cpp Wed Feb 02 09:09:52 2011 +0000
@@ -9,7 +9,7 @@
void printMeasurements(char *title, int n = 10) {
FILE *fp = fopen("/local/scp1000.txt", "a");
fprintf(fp, "%s\n", title);
-
+
for (int i = 0; !sw && i < n; i++) {
while (!scp1000.isReady())
;
@@ -18,20 +18,33 @@
strftime(buf, sizeof(buf), "%X", localtime(&seconds));
fprintf(fp, "%s %3.2f, %3.3f\n", buf, scp1000.readTemperature(), scp1000.readPressure());
leds[i % 4] = (i % 8) < 4;
- if (i % 100 == 99)
- freopen(NULL, "a", fp);
+ if (i % 100 == 99) {
+ fclose(fp);
+ fp = fopen("/local/scp1000.txt", "a");
+ }
}
-
+
fclose(fp);
wait(1.0);
}
int main() {
char buf[32];
-
+
+ if (sw) {
+ for (int i = 0; i < 4; i++) {
+ leds[i] = 1;
+ }
+ wait(3.0);
+ for (int i = 0; i < 4; i++) {
+ leds[i] = 0;
+ }
+ exit(0);
+ }
+
FILE *fp = fopen("/local/scp1000.txt", "a");
if (fp == NULL) exit(-1);
-
+
time_t seconds = time(NULL);
strftime(buf, sizeof(buf), "%x %X", localtime(&seconds));
fprintf(fp, "Time: %s\n", buf);
@@ -41,13 +54,13 @@
fprintf(fp, "SCP1000 reset\n");
scp1000.reset();
fclose(fp);
-
+
scp1000.setOperationMode(HIGH_SPEED_MODE);
- printMeasurements("SCP1000 High Speed Mode - 9Hz", 1000);
-
+ printMeasurements("SCP1000 High Speed Mode - 9Hz", 3600 * 9);
+
scp1000.setOperationMode(HIGH_RESOLUTION_MODE);
- printMeasurements("SCP1000 High Resolution Mode - 1.8Hz", 1000);
-
+ printMeasurements("SCP1000 High Resolution Mode - 1.8Hz", 3600 * 9 / 5);
+
scp1000.setOperationMode(ULTRA_LOW_POWER_MODE);
- printMeasurements("SCP1000 Ultra Low Power Mode - 1Hz", 1000);
+ printMeasurements("SCP1000 Ultra Low Power Mode - 1Hz", 3600 * 10);
}
\ No newline at end of file