newbie creating fsr voting system


i'm trying build (what should be) simple voting system, using bunch of force sensing resistors people tap, , vote cast.  however, clicking either sensor casting votes both buttons.  can tell me if code wrong or wiring off somehow?  (as mentioned in topic title, i'm new this, please bare me)
thanks in advance help!


int fsranalogpin0 = a0; // fsr connected analog 0
int fsranalogpin1 = a1;
int fsrreading0; // analog reading fsr resistor divider
int fsrreading1;
int delayint = 1000;
int fsrpresses0 = 0;
int fsrpresses1 = 0;

void setup() {
   serial.begin(9600);
}

void loop() {
  fsrreading0 = analogread(fsranalogpin0);
  fsrreading1 = analogread(fsranalogpin1);

  if( fsrreading0 != 0 ){
    fsrpresses0++;
    serial.print("button0: ");
    serial.println(fsrpresses0);
    serial.println();
    delay(delayint); 
  }
  if( fsrreading1 != 0 ){
    fsrpresses1++;
    serial.print("button1: ");
    serial.println(fsrpresses1);
    serial.println();
    delay(delayint); 
  }
}


using threshold of 0 not idea. read 2 sensors , print them out , come better threshold zero.


Arduino Forum > Using Arduino > Sensors > newbie creating fsr voting system


arduino

Comments

Popular posts from this blog

VIDIOC_S_FMT error 16, Device or resource busy - Raspberry Pi Forums

using a laptop skeleton to build a pi laptop - Raspberry Pi Forums

Forum for Joomla? - Joomla! Forum - community, help and support