Same as mallet... but distance
Dependencies: EthernetInterface NetworkAPI mbed-rtos mbed
Fork of MalletFirmware by
Revision 26:a00bf9837e03, committed 2014-12-03
- Comitter:
- timmey9
- Date:
- Wed Dec 03 16:40:51 2014 +0000
- Parent:
- 25:abbc19af13f9
- Child:
- 27:8c2b30c855d1
- Commit message:
- Kind of works, but probably wrong.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Dec 03 09:21:55 2014 +0000 +++ b/main.cpp Wed Dec 03 16:40:51 2014 +0000 @@ -43,7 +43,7 @@ // Analog sampling #define MAX_FADC 6000000 #define SAMPLING_RATE 10000 // In microseconds, so 10 us will be a sampling rate of 100 kHz -#define TOTAL_SAMPLES 10000 // originally 30000 for 0.3 ms of sampling. +#define TOTAL_SAMPLES 10 // originally 30000 for 0.3 ms of sampling. #define LAST_SAMPLE_INDEX (TOTAL_SAMPLES-1) // If sampling time is 25 us, then 2000 corresponds to 50 ms #define FIRST_SAMPLE_INDEX 0 @@ -357,7 +357,9 @@ // below is a crappy form of sampling ******************************* rotary_count = 0; - for(int i = 0; i < TOTAL_SAMPLES; i++) + client[index].write((void *)"Data\n",5); + + for(int i = 0; i < 10000; i++) { StatusIndicator2 = !StatusIndicator2; @@ -388,16 +390,28 @@ last_AMT20_AB_read = AMT20_AB; } - sample_array1[i] = A0_value; - sample_array2[i] = A2_value; - angle_array[i] = rotary_count; + + char buf[2]; + buf[1] = (A0_value >> 8) & 0xff; + buf[0] = A0_value & 0xff; + client[index].write((void *)buf,2); + buf[1] = (A2_value >> 8) & 0xff; + buf[0] = A2_value & 0xff; + client[index].write((void *)buf,2); + buf[1] = (rotary_count >> 8) & 0xff; + buf[0] = rotary_count & 0xff; + client[index].write((void *)buf,2); + + //sample_array1[i] = A0_value; + //sample_array2[i] = A2_value; + //angle_array[i] = rotary_count; wait_us(10); } - client[index].write((void *)"Data\n",5); - client[index].write((void *)&sample_array1,2*TOTAL_SAMPLES); - client[index].write((void *)&sample_array2,2*TOTAL_SAMPLES); - client[index].write((void *)&angle_array,2*TOTAL_SAMPLES); + + //client[index].write((void *)&sample_array1,2*TOTAL_SAMPLES); + //client[index].write((void *)&sample_array2,2*TOTAL_SAMPLES); + //client[index].write((void *)&angle_array,2*TOTAL_SAMPLES); //above is a crappy form of sampling ********************************