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.
Dependencies: SDFileSystem mbed
Revision 0:fa63e288286a, committed 2017-11-09
- Comitter:
- philliptran011
- Date:
- Thu Nov 09 19:02:08 2017 +0000
- Commit message:
- lab7
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SDFileSystem.lib Thu Nov 09 19:02:08 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/AlexVC97/code/SDFileSystem/#3bdfc1556537
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Nov 09 19:02:08 2017 +0000
@@ -0,0 +1,55 @@
+#include "mbed.h"
+#include "SDFileSystem.h"
+#include <stdint.h>
+
+
+Serial pc(USBTX, USBRX);
+InterruptIn R_Button(SW1);
+AnalogIn measure(PTB0);
+SDFileSystem sd(PTD6, PTD7, PTD5, PTD4, "sd");
+Ticker t;
+float buffer;
+bool flag = 0;
+
+void active() {
+ FILE *samples = fopen("/sd/samples.csv", "a");
+ buffer = measure.read();
+ if(buffer!=0) {
+ fprintf(samples, "%f\n", buffer);
+ pc.printf("Reading %f\n", buffer);
+ buffer = 0;
+ }
+ fclose(samples);
+}
+
+void change() {
+ pc.printf("In change function\n");
+ if (flag == 0) {
+ printf("Enabling Oscilloscope\n");
+ t.attach(&active, .01);
+ flag = 1;
+ printf("Flag set to 1\n");
+ }
+ else {
+ printf("Disabling Oscilloscope\n");
+ t.detach();
+ flag = 0;
+ printf("Flag set to 0\n");
+ }
+}
+
+int main() {
+ pc.baud(115200);
+ pc.printf("Connection Established\n");
+ pc.printf("File should be created\n");
+ FILE *samples = fopen("/sd/samples.csv", "w");
+ if(samples == NULL) {
+ pc.printf("But the file doesn't exist \n");
+ }
+
+ fclose(samples);
+ R_Button.mode(PullUp);
+ R_Button.fall(&change);
+ while(true) {
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Nov 09 19:02:08 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/176b8275d35d \ No newline at end of file