I need help figuring out why only one of my force sensors work (tinkercad, c++)

82 views Asked by At

raw code:

int buzzer = 11; 
int forcePin1 = A1; 
int forcePin2 = A2; 
int Forcevalue = 0; 

void setup() 
{ 
    pinMode(forcePin1, INPUT); 
    pinMode(forcePin2, INPUT); 
    pinMode(buzzer, OUTPUT); 
    Serial.begin(9600); 
}
void loop() 
{ 
    Forcevalue = analogRead(forcePin1 && forcePin2); 
    Serial.println (Forcevalue); 
    noTone(buzzer); 
    tone(buzzer,Forcevalue); 
}

I don't know why it only cares about forcePin1, I've tried changing the "&&" to "=+" and that made it only care about forcePin2 instead.

If someone could help me make it so either one or both of forcePin1 and forcePin2 needs to be activated for the buzzer to ring, that'd be greatly appreciated

Screenshot of tinkercad: https://gyazo.com/e0332aae51465ee17f8c6d3767f93345

Code on tinkercad: https://gyazo.com/73be78c2bf210dd41b29ca236c57f0c6

0

There are 0 answers