An ADCInput example working from the IDE

The Philhower ADCInput library appears to do everything for the Pico ADCs. I'm unable to find a working example that doesn't require many includes that I don't have. Does anyone have an example using this library from the IDE?

Did you installed the Philhower Pico arduino package?

No. I installed the Philhower core but there was no accompanying library. Many examples work on the Raspberry PI Pico RP2040 after I back loaded the core to Ver: 2.6.1. Can you suggest a way to make a proper library? BTY, thanks for the help. - Larry

I installed the two libs with Mr. Philhower's name and everything got much better. One missing .h found on github and using testADC.ino from the examples, I'm sampling 12 bits at 230 Kc/s.

Got stuck many times with no port and weird errors. Someone suggested uninstalling/reinstalling the core and the IDE. Apparently I was crashing the RP2040 and that broke something in the core/IDE.

I'm really pleased with the board. Here's a double buffer routine running on both CPUs. It needs cleanup but maybe someone else can use it.

// twoBuffers.ino
// Demonstrates two buffers and two processors alternately psedo-sampling and pseudo-storing to uSD
// I'm pretty sure the store is faster so that's why I rigged Core1 twice as fast as Core0
// Larry Gorham
// This code is public domain
//
#define BUFFSIZE 512
#define UPDATES 4
uint16_t buff[BUFFSIZE*2];
int flag = 0;
int flip = 0;
int last = 1000;
uint32_t tim;
int pCtr = 0;
uint32_t fl = 0;
// Running Core0
void setup() {
  Serial.begin(115200);
  tim = millis();
  delay(3000);
//   Initialize first buffer
  for (int i = 0; i < BUFFSIZE; i++) {

    buff[i] = i + last ;

    tim = millis();
    Serial.printf("%lu   C0 samples %d & Writes to buff%d at location %d\n",tim,buff[i],flip,i);

    pCtr++;
    delay(2);
  }

  flag = flip + 1;
  flip = (flip + 1) % 2;

  tim =    millis();

  pCtr++;

  for (int iUp = 1 ; iUp <= UPDATES ; iUp++){
    for (int i = 0; i < BUFFSIZE; i++) {
      int k = i + (iUp)*(BUFFSIZE-1) + iUp;
      int j = flip*BUFFSIZE + i;
      buff[j] = k + last ;

      tim = millis();
      Serial.printf("%lu   C0 samples %d & Writes to buff%d at location %d\n",tim,buff[j],flip,j);
      //Serial.printf("i = %d, j = %d,  k = %d, iUp = %d, last = %d\n", i, j, k, iUp, last);

      pCtr++;
      delay(2);

    }
  flag = flip + 1;
  flip = (flip + 1) % 2;
  
    tim =    millis();

    // last++;
    pCtr++;

  }
}

void loop() {}

// Running on Core1
void setup1() {
  Serial.begin(115200);
  delay(3000); 

  for (int iUp = 1 ; iUp <= UPDATES ; iUp++){
      while (flag == 0){
        delay(1);
      }
//    }else{
      for (int i = 0; i < BUFFSIZE; i++) {
        //int k = i + (iUp-1)*BUFFSIZE;
        int j = (flag-1)*BUFFSIZE + i;
        
        tim = millis();
        Serial.printf("%lu    C1 reads location %d of buff%d & Writes %d to uSD\n",tim, j,flag-1,buff[j]);
        //Serial.printf("i = %d, j = %d,  k = %d, iUp = %d, last = %d\n", i, j, k, iUp, last);

        pCtr++;

        delay(1);
      }

    tim =   millis();

    pCtr++;
    flag = 0;

    delay(1);

  }

  Serial.print("C0 pCtr = ");
  Serial.println(pCtr);
 
}

void loop1() {
}

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.