Tu Hoang
/
Test_nucleo_MCUUU_EEPROMTEST
EEPROMTEST
Fork of Test_nucleo_MCUUU by
Revision 17:41160d6c66ae, committed 2018-05-23
- Comitter:
- MockyBirdTwo
- Date:
- Wed May 23 09:35:34 2018 +0000
- Parent:
- 16:c998931f8395
- Commit message:
- Opgeschoond
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r c998931f8395 -r 41160d6c66ae main.cpp --- a/main.cpp Wed May 23 09:22:05 2018 +0000 +++ b/main.cpp Wed May 23 09:35:34 2018 +0000 @@ -6,33 +6,14 @@ using namespace std; I2C i2c(PB_9, PB_8); // I2C for sensorplate. -Adafruit_ADS1115 piezo_resistive_adc1(&i2c, 0x48); // i2c pins, i2c address. -Adafruit_ADS1115 piezo_resistive_adc2(&i2c, 0x49); // i2c pins, i2c address. -Adafruit_ADS1115 piezo_electric_adc(&i2c, 0x4B); // i2c pins, i2c address. - - Serial usb_serial(SERIAL_TX, SERIAL_RX); // tx, rx int i2c__frequency = 100000; // I2C Frequency. int baud_rate = 115200; // Baud rate. Timer timer; - // array to save sensor data - DigitalOut myled(LED1); -//Check whether any sensor values are zero -void checkzero (vector<int>& sendat, int size){ - usb_serial.printf("Zero:"); - for(int i=0;i<size;++i){ - if(sendat[i]> -5 & sendat[i] < 5){ - sendat[i]=0;} - if(sendat[i]!= 0){ - usb_serial.printf("%d\n", i);} - else{ - usb_serial.printf("%d\n", i);} - } -} //EEPROM // Device Code Chip Enable RW //Bit b7 b6 b5 b4 b3 b2 b1 b0 @@ -86,8 +67,6 @@ i2c.frequency(i2c__frequency); // Set frequency for i2c connection to sensorplate (variable is declared in config part). usb_serial.baud(baud_rate); // Set serial USB connection baud rate (variable is declared in config part). -// vector<int> S_data(8); - uint32_t Wreg= 10; int8_t EEPROM_dat=56; int8_t result=0; @@ -96,31 +75,4 @@ EEPROM_write(Wreg,EEPROM_dat); EEPROM_read(Wreg,result); usb_serial.printf("EEPROMdata = %d\r\n", result); - -// piezo_resistive_adc1.setGain(GAIN_TWOTHIRDS); // Set ranges of ADC to +/-6.144V (end is marked with #): -// piezo_resistive_adc2.setGain(GAIN_TWOTHIRDS); -// -// usb_serial.printf("Gains set.\n"); -// -// timer.start(); -// while(1){ -// while(timer.read_us() < 2000){}; timer.reset(); //Set readout frequency -// - -// //usb_serial.printf("Piezo electric 0_1 dif %d \n", piezo_electric_adc.readADC_Differential_0_1()); // First PE readout. -//// usb_serial.printf("Piezo electric 2_3 dif %d \n", piezo_electric_adc.readADC_Differential_2_3()); -// -// for (uint8_t t=0; t<4; ++t){ //Save sensor data into array -// S_data[t] = (int16_t) piezo_resistive_adc1.readADC_SingleEnded(t); //Put first 4 PR sensor data into first 4 S_data array -// S_data[t+4]= (int16_t) piezo_resistive_adc2.readADC_SingleEnded(t); //Put next 4 PR sensor data into first 4 S_data array -// } -// -// checkzero(S_data,S_data.size()); //Check whether any sensor values are zero -// for (uint8_t k = 0; k < 4; ++k) { -// usb_serial.printf("R %d Ar %d: %d\n", k, 1, S_data[k]); // First 4 PR readout. -// usb_serial.printf("R %d Ar %d: %d\n", k, 2, S_data[k+4]); // Next 4 PR readout. -// } -// -// -// } } \ No newline at end of file