Hello sorry for bad englisch and sorry if already asked but i did not find an answer.
I am trying to control a x9c104 but i cannot get it to have more than about 30 steps (full 100k ohm range)
I dont know if i am misunderstand something but i think it shoud have 100 steps?
I need help on how to fix the range, a clarification or an alernative.
Thanks in advance.
setup:
Resistor 10k pullup from vin for POT-INC
Vcc 5v
Gnd 0v
Pot Rh 4.3v (vin back redcable)
Pot Rl 0v (gnd back blue and front black cable)
Pot Rw probe Blue (A0 back yellow
Front left to right
5v red
Gnd black
White POT_INC pin 2
Brown POT_UD PIN 3
Orange POT_CS pin 4
YELLOW=POT_INC
BLUE=POT OUTPUT (trigger)
Short blue flats are new call of pulseup(10)
My test code:
Code for analog read can be ignored
uint8_t POT_CS = 4;
uint8_t POT_UD = 3;
uint8_t POT_INC = 2;
uint8_t AREAD = A0;
int val = 0;
int val2 = 0;
void setup() {
Serial.begin(9600);
pinMode(POT_CS, OUTPUT);
pinMode(POT_UD, OUTPUT);
pinMode(POT_INC, OUTPUT);
pinMode(AREAD, INPUT);
digitalWrite(POT_INC, LOW);
digitalWrite(POT_UD, LOW);
digitalWrite(POT_CS, HIGH);
delay(200);
pulseDown(100);
val=0;
}
void pulseUp(int count) {
digitalWrite(POT_CS, LOW);
digitalWrite(POT_UD, HIGH);
val+=count;
while(count>0){
delay (10);
digitalWrite(POT_INC, HIGH);
delay (10);
digitalWrite(POT_INC, LOW);
count--;
}
digitalWrite(POT_CS, HIGH);
digitalWrite(POT_UD, LOW);
}
void pulseDown(int count) {
digitalWrite(POT_CS, LOW);
digitalWrite(POT_UD, LOW);
val-=count;
while(count>0){
delay (1);
digitalWrite(POT_INC, HIGH);
delay (1);
digitalWrite(POT_INC, LOW);
count--;
}
digitalWrite(POT_CS, HIGH);
digitalWrite(POT_UD, LOW);
}
void loop() {
//Serial.println("start");
delay(100);
pulseUp(10);
pulseUp(10);
pulseUp(10);
pulseUp(10);
;
while (true){
delay (1000);
}
//pulseDown(100);
//Serial.println(val);
//delay (2000);
//if (val >= 256) val = 0;
//analogWrite(LEDPIN,val);
//delay(100);
//Serial.println(val);
//val += 1;
}
Greetings playprogramm




