![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
EEPROMTEST
Fork of Test_nucleo_MCUUU by
Diff: main.cpp
- Revision:
- 1:8c5bcf47869e
- Parent:
- 0:952479e15354
- Child:
- 2:78e48758fa6b
--- a/main.cpp Fri May 04 13:16:16 2018 +0000 +++ b/main.cpp Mon May 07 09:00:16 2018 +0000 @@ -1,14 +1,6 @@ #include "mbed.h" // Include files and define parameters. #include "Adafruit_ADS1015.h" -/* -The code underneath this commentbox has some fixed parameters for serial/ADC reading: --> The address for the angle_device_reference_belt is set to 0x68 in the file MPU6050_belt (rule number: 19); --> The adress for the angle_device_sensorplate is set to 0x69 in the file MPU6050.h (rule number: 19); --> This is because of using the same I2C line; --> For detailed information/questions about this item, please read the technical manual or contact: Ricardo Molenaar | ricardo.molenaar@gmail.com -*/ - I2C i2c_sensorplate_adc(PB_9, PB_8); // I2C for sensorplate. Adafruit_ADS1115 piezo_resistive_adc1(&i2c_sensorplate_adc, 0x48); // i2c pins, i2c address. Adafruit_ADS1115 piezo_resistive_adc2(&i2c_sensorplate_adc, 0x49); // i2c pins, i2c address. @@ -22,30 +14,29 @@ int main(){ - usb_serial.printf("Hello World !\n"); i2c_sensorplate_adc.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). + usb_serial.printf("Hello World !\n"); + 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"); - - int i = 0; + while(1){ - wait_ms(500); + wait_ms(2); myled = !myled; //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 k = 0; k < 4; ++k) { - usb_serial.printf("piezo res %d array %d: %d\n", k, 1, piezo_resistive_adc1.readADC_SingleEnded(k)); // First 4 PR readout. - usb_serial.printf("piezo res %d array %d: %d\n", k, 2, piezo_resistive_adc2.readADC_SingleEnded(k)); // First 4 PR readout. + usb_serial.printf("piezo res %d array %d: %d\n", k, 1, (int16_t) piezo_resistive_adc1.readADC_SingleEnded(k)); // First 4 PR readout. + usb_serial.printf("piezo res %d array %d: %d\n", k, 2, (int16_t) piezo_resistive_adc2.readADC_SingleEnded(k)); // First 4 PR readout. } - usb_serial.printf("This program runs since %d seconds.\n", i++); } } \ No newline at end of file