bunch of tesitng for F746NG
Dependencies: BSP_DISCO_F746NG F746_GUI F7_Ethernet LCD_DISCO_F746NG SimpleSocket TMP36 GZ TS_DISCO_F746NG TextLCD WebSocketClient mbed-rtos mbed sMotor
input_functions.cpp
- Committer:
- Maricius
- Date:
- 2017-12-11
- Revision:
- 0:45610c4af223
- Child:
- 1:1f4543ea364d
File content as of revision 0:45610c4af223:
#include "mbed.h" #include "rtos.h" AnalogIn heart_rate2(A0); AnalogIn adc_temp(A3); AnalogIn adc_sound(A1); //AnalogOut buzzer(D4); //AnalogIn Proximity_measure(A2); void heartrate(); void sound(); void temp(); //void write_to_socket(); //void proximity(); double h; double *h_p = (double*)malloc(20*sizeof(double)); void heartrate(){ h_p = &h; while (1){ h = heart_rate2.read(); wait(0.1); } } void temp(){ //------------------------------------------------------------------------// //This section is using the external temperatur sensor "Grove temperatur sensor v1.2 //float resistance; const int B = 4275; //const int R0 = 10000; //char temp[10]; //reads the voltage from the analog temperatur sensor double a = adc_temp.read(); double R; R = 1023.0/a-1.0; //R = R0*R; double temperature; //Calculate the temperature from the voltage temperature = 1.0/(log(R)/B+1/298.15)-173.15; //temperature = ((a*1000)-500)/10; //sprintf(temp, "%f", a); //resistance=(float)(1023-a)*10000/a; //get the resistance of the sensor; //temperature=1/(log(resistance/10000)/B+1/298.15)-273.15;//convert to temperature via datasheet ; //delay(100); } void sound() { float b = adc_sound.read(); char temp_sound[10]; float noiselevel; noiselevel = b; //if the sound sensor is detection any noise a LED is switched on and a message with the current sound level is displayed. if (noiselevel != 0) { //do something with noiselevel!! } //external_LCD.DisplayStringAt(0, LINE(1), (uint8_t *)"This is just a test", CENTER_MODE); wait(0.1); } //void write_to_stocket(){ // } /*void proximity(){ double prox_read; while(1){ prox_read = Proximity_measure.read(); wait(0.5); buzzer.write(0); wait(3); } }*/