mbed code Inductive_Sensor_Jasper for Bsc paper
Dependencies: Bob DS1825 LDC1101 SDFileSystem mbed
Fork of Inductive_Sensor by
main.cpp
- Committer:
- bobgiesberts
- Date:
- 2015-12-10
- Revision:
- 0:e81b68888268
- Child:
- 1:22c272515015
File content as of revision 0:e81b68888268:
#include "mbed.h" #include "LDC1101.h" #include <iostream> using namespace std; // Feedback on console Serial pc(USBTX, USBRX); // Feedback with leds DigitalOut redled(PTB0); // Red DigitalOut greenled(PTB1); // Green void flash(int n){ for(int i = 0; i < n*2; i++){ redled = 1-redled; greenled = 1-greenled; wait(0.2); } } // Main action int main(void){ pc.printf("5x knipperen...\n"); flash(5); pc.printf("Contact maken met LDC1101...\n"); // mosi = PTC6 (PTD2) // miso = PTC7 (PTD3) // sck = PTC5 (PTD1) // cs = PTC4 (PTB0) // capacitor = 120E-12 (100E-12) // f_external = 6.5E6 (6000000) // clock_out = PTA18? (PTA13) LDC1101 ldc(PTC6, PTC7, PTC5, PTC4, 120E-12, 6500000); while(1) { flash(1); pc.printf("%4.0f",ldc.get_raw_l()); pc.printf(", %f \r\n", 1000000*ldc.getInductance()); wait_ms(250); } }