Re: Compiling ML-v410 code


VE7VXO
 
Edited

The newer versions of the Arduino IDE do not like direct references to the hardware serial constructor. 
So, for this error:

no matching function for call to 'HardwareSerial::HardwareSerial()'

 Do this instead at the location of the error in the main  .ino file:

// Define a "Uart" object to access the serial port
//HardwareSerial Uart = HardwareSerial();  (comment out or remove this line)
#define Uart  Serial1  (Add this line to replace the one above)


After correcting that, you may also get some compile errors due to the analog to digital converter library due to the way that ADC1 was referenced in the magloop code. 

call to 'ADC::setSamplingSpeed' declared with attribute error: Use adc->adcX->setSamplingSpeed instead

Replace the offending section with the version below in blue to reference ADC0 and ADC1:

  adc->setSamplingSpeed(ADC_SAMPLING_SPEED::LOW_SPEED);       // Sampling speed, ADC_VERY_LOW_SPEED, ADC_LOW_SPEED, ADC_MED_SPEED, ADC_HIGH_SPEED or ADC_VERY_HIGH_SPEED
  adc->setSamplingSpeed(ADC_SAMPLING_SPEED::LOW_SPEED, ADC_1);
  adc->setConversionSpeed(ADC_CONVERSION_SPEED::LOW_SPEED);   // Conversion speed
  adc->setConversionSpeed(ADC_CONVERSION_SPEED::LOW_SPEED, ADC_1);
  adc->setResolution(12);                        // AD resolution, 12 bits
  adc->setResolution(12, ADC_1);
  adc->setAveraging(16);                         // Averaging by taking multiple samples.
  adc->setAveraging(16, ADC_1);                  // 16 samples takes approx 80us per measurement and is just about
                                                // good enough for 12 bit resolution w/o too much noise on LSB




  // Set up the two separate ADCs for synchronous read at 12 bit resolution and lowest possible measurement speed (minimal noise)
 
  adc->adc0->setSamplingSpeed(ADC_SAMPLING_SPEED::LOW_SPEED);       // Sampling speed, ADC_VERY_LOW_SPEED, ADC_LOW_SPEED, ADC_MED_SPEED, ADC_HIGH_SPEED or ADC_VERY_HIGH_SPEED
  adc->adc0->setConversionSpeed(ADC_CONVERSION_SPEED::LOW_SPEED);   // Conversion speed
  adc->adc0->setResolution(12);                                     // AD resolution, 12 bits
  adc->adc0->setAveraging(16);                                      // Averaging by taking multiple samples.
                                                                    // 16 samples takes approx 80us per measurement and is just about
                                                                    // good enough for 12 bit resolution w/o too much noise on LSB

  adc->adc1->setSamplingSpeed(ADC_SAMPLING_SPEED::LOW_SPEED);       // Sampling speed, ADC_VERY_LOW_SPEED, ADC_LOW_SPEED, ADC_MED_SPEED, ADC_HIGH_SPEED or ADC_VERY_HIGH_SPEED
  adc->adc1->setConversionSpeed(ADC_CONVERSION_SPEED::LOW_SPEED);   // Conversion speed
  adc->adc1->setResolution(12);                                     // AD resolution, 12 bits
  adc->adc1->setAveraging(16);                                      // Averaging by taking multiple samples.
                                                                    // 16 samples takes approx 80us per measurement and is just about
                                                                    // good enough for 12 bit resolution w/o too much noise on LSB


(This post was edited to correct a previous error)
Best regards all...Joe ve7vxo

Join loopController@groups.io to automatically receive all group messages.