i was creating a breathing program and this error message popped up: exit status 1
Error compiling for board Arduino/Genuino Uno. does it have to do with file size or is it just my code?
Code:
//this is only gonna run once so this is only a test
//Variables
int blueled = 7;
int redled = 8;
float breathing[24];
float Counter1;
int minbreath = 5;
int maxbreath = 10;
float Counter2;
int minutes = 2;
int varcount = 3;
int alertconditional = 5;
constrain(alertconditional, 1, 4); // how it was going to do the five times in three minutes (check the asterisks, same with the other constrains)
int alertconditional1 = 30;
constrain(alertconditional1, 11, 28);
int goodconditional = 10;
constrain(goodconditional, 6, 9);
boolean digitaltoanalog; // to check the analoginput
//Variables
unsigned long Timer; // my original attempt at creating a timer, which will now be known as //T
unsigned long starttime;
unsigned long endtime;
void setup() {
Serial.begin(9600);
pinMode(blueled, OUTPUT);
pinMode(redled, OUTPUT);
Timer = millis();//T
}
void loop() {
// this is to count the number of breaths a dog takes in a minute, and a potentiometer is used to replicate a flex sensor
float regularvolt = (analogRead(A2)) * 45.0 / 1024.0;
starttime = millis();
endtime = starttime;
while ((endtime - starttime) <=1000){
delay(6000);
if(millis()-Timer >= 6000UL){
if(regularvolt++){
++breathing[2];
}
if(regularvolt--){
++breathing[2];
int loopcount = loopcount+1;
endtime = millis();
}
}
}
breathing[2] = Counter1;
Serial.println(breathing[2]); // placeholder to see if everything is working correctly
delay(700);
breathing[2] = 0;
// this is used as a buffer, because the purpose of the program is to check the breathing rate of a dog and if there is something wrong
// it will flash a blue led, therefore this is used as a buffer to make so that if the dog's breathing spikes and then slows, it doesn't send
// an alarm signal
if(minbreath < Counter1 && Counter1 < maxbreath){
Counter1 += 0; // this is pretty much just here to setup the else statement
}
else {
Counter2++;
}
if(minutes>Counter2++){
Counter2 = 0;
}
// ******so these are all the alarm signals which are as follows: when counter2 >= varcount blink Blueled
//if the analoginput is turned on-off less than 5 times in one minute and you keep doing that for three minutes, blink blueled
//if the analoginput is turned on-off more than 10 times in one minute and you keep doing that for three minutes, blink blueled
//as long as you turn the potentiometer on-off more than 5 but less than ten times, blink redled(real counterintuitive btw, note to myself)
//make counter 2 reset if you turn the potentiometer on-off less than 5 or more than ten times for a minute, then goes back to regular range(5times-10times)
if(Counter2 >= varcount){
digitalWrite(blueled, HIGH);
delay(500);
digitalWrite(blueled, LOW);
delay(500);
digitalWrite(blueled, HIGH);
delay(500);
digitalWrite(blueled, LOW);
delay(500);
digitalWrite(blueled, HIGH);
delay(500);
digitalWrite(blueled, LOW);
delay(500);
}
if(regularvolt > 0){
digitaltoanalog = true;
}
else{
digitaltoanalog = false;
}
if(millis()-Timer >= 6000UL && alertconditional == digitaltoanalog ){ //T
if(millis()-Timer >= 18000UL && alertconditional == digitaltoanalog ){ //T
digitalWrite(blueled, HIGH);
delay(500);
digitalWrite(blueled, LOW);
delay(500);
digitalWrite(blueled, HIGH);
delay(500);
digitalWrite(blueled, LOW);
delay(500);
}
}
if(millis()-Timer >= 6000UL && alertconditional1 == digitaltoanalog){ //T
if(millis()-Timer >= 18000UL && alertconditional1 == digitaltoanalog){ //T
digitalWrite(blueled, HIGH);
delay(500);
digitalWrite(blueled, LOW);
delay(500);
}
}
if(goodconditional == digitaltoanalog){
digitalWrite(redled, HIGH);
delay(500);
digitalWrite(redled, LOW);
delay(500);
}
if(millis()-Timer >= 6000UL && alertconditional == digitaltoanalog || alertconditional1 == digitaltoanalog){ //T
if(minbreath < Counter1 && Counter1 < maxbreath){
Counter2 = 0;
}
}
}