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: mbed
Diff: main.cpp
- Revision:
- 0:005922ecb765
- Child:
- 1:d1e89afbe50c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Feb 14 10:05:03 2018 +0000
@@ -0,0 +1,63 @@
+Rango says, hey there Conor!
+
+#include "mbed.h"
+
+DigitalOut myled(LED1);
+AnalogIn Ain(PTB1);
+
+int const MAX_B = 20;
+int const delta = 0.5;
+int sample_buffer[MAX_B] = {};
+int local_buffer[MAX_B] = {};
+int read = 0;
+int write = 0;
+int sum = 0;
+int prev
+
+Ticker sampler;
+Timer t;
+
+void sampling() {
+ unsigned int sample = Ain.read_u16();
+ sample_buffer[write++]=sample;
+
+ write = write%MAX_B;
+}
+
+int get_trend(int current) {
+ int trend;
+
+ return trend;
+}
+
+void data_process() {
+ int trend = get_trend();
+ int range = max(data)-min(data);
+}
+
+int filter (int x, int y) {
+ return delta*(x)+ (1-delta)*y;
+}
+
+
+int main() {
+ sampler.attach(&sampling, 0.0125); //Sample at 80Hz
+ //t.start();
+ //t.wait(0.1);
+
+ while(1) {
+ //t.reset();
+ //start = t.read();
+ if (write-read > MAX_B/2 || read-write > MAX_B/2) { // |write-read| > MAX_B/2
+ for(int i = 0; i < MAX_B/2; i++) {
+ local_buffer[i] = sample_buffer[read];
+ read = (++read) % MAX_B;
+ }
+ }
+ data_process();
+
+ }
+}
+
+
+

