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
main.cpp
- Committer:
- 2236693B
- Date:
- 2018-02-14
- Revision:
- 1:d1e89afbe50c
- Parent:
- 0:005922ecb765
- Child:
- 2:29c3d03c9231
File content as of revision 1:d1e89afbe50c:
//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;
void data_process() {
    
}
int main() {
    sampler.attach(&sampling, 0.0125); //Sample at 80Hz 
    
    while(1) {
        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();
    }
}
            
    
