 	pinMode(BUTTON_PIN, INPUT_PULLUP);
 
 	adc->setReference(ADC_REF_EXT, ADC_0);
-    adc->setAveraging(1, ADC_0); // set number of averages
+    adc->setAveraging(16, ADC_0); // set number of averages
     adc->setResolution(16, ADC_0); // set bits of resolution
-    adc->setConversionSpeed(ADC_HIGH_SPEED_16BITS, ADC_0); // change the conversion speed
-    adc->setSamplingSpeed(ADC_HIGH_SPEED_16BITS, ADC_0); // change the sampling speed
+    adc->setConversionSpeed(ADC_MED_SPEED, ADC_0); // change the conversion speed
+    adc->setSamplingSpeed(ADC_MED_SPEED  , ADC_0); // change the sampling speed
 
 	adc->setReference(ADC_REF_EXT, ADC_1);
-    adc->setAveraging(1, ADC_1); // set number of averages
+    adc->setAveraging(16, ADC_1); // set number of averages
     adc->setResolution(16, ADC_1); // set bits of resolution
-    adc->setConversionSpeed(ADC_HIGH_SPEED_16BITS, ADC_1); // change the conversion speed
-    adc->setSamplingSpeed(ADC_HIGH_SPEED_16BITS, ADC_1); // change the sampling speed
+    adc->setConversionSpeed(ADC_MED_SPEED, ADC_1); // change the conversion speed
+    adc->setSamplingSpeed(ADC_MED_SPEED  , ADC_1); // change the sampling speed
 
     adc->enableCompare(1.0/2.5*adc->getMaxValue(ADC_0), 0, ADC_0); // measurement will be ready if value < 1.0V
     adc->enableCompare(1.0/2.5*adc->getMaxValue(ADC_1), 0, ADC_1); // measurement will be ready if value < 1.0V


	//format the CSV line
	sprintf(str, "%lu, %i, %.3f, %.3f, %.3f, %.3f, %.2f\n", time, commandValue, a1, a2, a3, a4, scaleValue);

	//write the CSV line to the block buffer
	size_t thisLength;
	size_t bufferLength;

	commandBuffer[0].value = 1100;
	commandBuffer[1].mode = MODE_RAMP;
	commandBuffer[1].time = 4000;
	commandBuffer[1].value = 2000;
	commandBuffer[2].mode = MODE_HOLD;
	commandBuffer[2].time = 2000;
	commandBuffer[2].value = 2000;
	commandBuffer[3].mode = MODE_HOLD;
	commandBuffer[3].time = 1000;
	commandBuffer[3].value = 1100;
