Problem with MCP4251

Hi, I used this code for program an ARDUINOUNO and i connected
the ICSP with MCP4251/104E-P:

#include "MCP4251.h"

#define cs1 2


#define pot0ResistanceRmax 100000 // These resistance values may vary
#define pot0ResistanceRmin 0
#define pot1ResistanceRmax 100000
#define pot1ResistanceRmin 0

MCP4251 f0(cs1, pot0ResistanceRmax, pot0ResistanceRmin, pot1ResistanceRmax, pot1ResistanceRmin);

uint16_t wiper0;
uint16_t wiper1;

float x=0.0;

void freq0(float freq)
{
   
    //primo pot. (100K)
    for(x=0; x<100001; x++)
    {
    wiper1 = f0.DigitalPotResistanceToPosition(1, x);
    f0.DigitalPotSetWiperPosition(1, wiper1);
    //delay(10);
    }
}




void setup() {
    Serial.begin(9600);
    f0.begin();
    f0.DigitalPotTerminalBConnect(0);
    f0.DigitalPotTerminalAConnect(0);
    f0.DigitalPotWiperConnect(0);
}

void loop() {
  freq0(0.0);
}

With the code above I used the MCP4251 library and I obtain in the ohmeter a maximun of 21Kohms and I want to obtain 100KohmsMax. Why it append this?

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