multithreading example

Dependencies:   FastAnalogIn

main.cpp

Committer:
candre97
Date:
2019-11-25
Revision:
109:1d95a4596fb5
Parent:
103:2da5fc276330
Child:
110:037667235b6d

File content as of revision 109:1d95a4596fb5:

/* mbed Microcontroller Library
 * Copyright (c) 2018 ARM Limited
 * SPDX-License-Identifier: Apache-2.0
 */

#include "mbed.h"
#include "platform/mbed_thread.h"
#include "stats_report.h"
#include <AnalogIn.h>
#include <AnalogOut.h>
#include "circ_buff.hpp"

AnalogOut v_src(GPIO0);
AnalogIn therm(GPIO2);

#define SLEEP_TIME                  500 // (msec)
#define PRINT_AFTER_N_LOOPS         20

#include "mbed.h"
 
//DigitalOut led1(LED1);
//DigitalOut led2(LED2);
Thread thread_adc;

Thread thread_mfcc;
 
void adc_thread() {
    while (true) {
        printf("Top of ADC sampling thread");
        
        wait(0.6);
    }
}

/* 
    this thread is in charge of converting 
*/
void mfcc_thread() {
    while (true) {
        printf("Top of MFCC thread");
        
        wait(2);
    }
}

int main() {
    thread_adc.start(adc_thread);
    thread_mfcc.start(mfcc_thread);
}