15kHz with multiplexing
Dependencies: FastAnalogIn mbed
Diff: main.cpp
- Revision:
- 2:25f679fea061
- Parent:
- 1:8e7e9ef6b0bd
--- a/main.cpp Tue Mar 07 18:43:43 2017 +0000 +++ b/main.cpp Wed Mar 08 16:47:56 2017 +0000 @@ -20,6 +20,7 @@ DigitalOut PDmux3(p17); //s3 AnalogOut aout(p18); +int LED; //counter for LEDs double voltageOut; double readIn[5]; @@ -78,22 +79,12 @@ } voltageOut=(readIn[2]+readIn[3]+readIn[4])/3; - aout=voltageOut; + aout=voltageOut; //Sets Voltage out to Pin 18 for debugging on scope - //send the diode readings to Matlab - if(pd==0) { - pc.printf("1,%f \n", voltageOut); - } else if(pd==1) { - pc.printf("2,%f \n", voltageOut+10); - } else if(pd==2) { - pc.printf("3,%f \n", voltageOut+20); - } else if(pd==3) { - pc.printf("4,%f \n", voltageOut+30); - } else if(pd==4) { - pc.printf("5,%f \n", voltageOut+40); - } else { - pc.printf("6,%f \n", voltageOut+50); - } + //send the diode readings to MATlab in format: LED,PD,Voltageout + //I think this is where you want to report voltageOut to ROS for the PD/LED combo + + pc.printf("%d,%d,%f \n",LED,pd,voltageOut);