#include <Adafruit_NeoPixel.h>
#define PIN 6
int val1;
int val2;
int val3;
int val4;
int setPoint1 = 100;
int setPoint2 = 100;
int setPoint3 = 100;
int setPoint4 = 100;
//int A = 100;
//int B = 300;
boolean countcheck1 = false;
boolean countcheck2 = false;
boolean countcheck3 = false;
boolean countcheck4 = false;
int count = 0;
int changes = 0;
Adafruit_NeoPixel strip = Adafruit_NeoPixel(8, 2, NEO_GRB + NEO_KHZ800);
void setup()
{
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
pinMode(10, OUTPUT);
pinMode(A3, INPUT);
pinMode(A4, INPUT);
pinMode(A5, INPUT);
pinMode(A2, INPUT);
Serial.begin(9600);
digitalWrite(13, HIGH);
digitalWrite(12, HIGH);
digitalWrite(11, HIGH);
digitalWrite(10, HIGH);
strip.begin();
strip.show();
// stripone.begin();
// stripone.show();
}
void loop() {
val1 = analogRead(A3); // Read the analogue input value
//Serial.print("1ai");
//Serial.println(aiValue1);
//Serial.print("slot1count");
//Serial.println(slot1count);
if (val1 < setPoint1 && countcheck1 == false)
{ count = count + 5;
Serial.println("count1");
countcheck1 = true;
}
if (val1 > setPoint1)
{ countcheck1 = false;
}
val2 = analogRead(A4); // Read the analogue input value
//Serial.print("2ai");
//Serial.println(aiValue2);
//Serial.print("slot2count");
//Serial.println(slot2count);
if (val2 < setPoint2 && countcheck2 == false)
{ count = count + 10;
Serial.println("count2");
countcheck2 = true;
}
if (val2 > setPoint2)
{ countcheck2 = false;
}
val3 = analogRead(A5); // Read the analogue input value
//Serial.print("1ai");
//Serial.println(aiValue1);
//Serial.print("slot1count");
//Serial.println(slot1count);
if (val3 < setPoint3 && countcheck3 == false)
{ count = count + 25;
Serial.println("count3");
countcheck3 = true;
}
if (val3 > setPoint3)
{ countcheck3 = false;
}
val4 = analogRead(A2); // Read the analogue input value
if (val4 < setPoint4 && countcheck4 == false)
{ count = count + 1;
Serial.println("count4");
countcheck4 = true;
}
if (val4 > setPoint4)
{ countcheck4 = false;
}
No comments:
Post a Comment