When we tried to compile our code,and a message saying "exit status 1
Error compiling." appears. What to do? Thanks.
here's our code
/*
* TimeAlarmExample.pde
*
* This example calls alarm functions at 8:30 am and at 5:45 pm (17:45)
* and simulates turning lights on at night and off in the morning
* A weekly timer is set for Saturdays at 8:30:30
*
* A timer is called every 15 seconds
* Another timer is called once only after 10 seconds
*
* At startup the time is set to Jan 1 2011 8:29 am
*/
// Questions? Ask them here:
// http://forum.arduino.cc/index.php?topic=66054.0
#include "Time.h"
#include "TimeLib.h"
#include "TimeAlarms.h"
#include <Wire.h>
#include <LiquidCrystal.h>
#include "Bounce2.h"
#define buttonIncrease 2 // general purpose increase for alarm set, time set
#define buttonDecrease 3 // general purpose decrease for alarm set, time set
#define buttonOK 8
#define alarmSpeaker 9
LiquidCrystal lcd(A0, A1, A2, A3, A4, A5);
int Menuposition = 0;
int mathValOne = 0;
int mathValTwo = 0;
int mathValThree = 0;
int inputAnswer = 100;
int realAnswer = 0;
int toneOn = 0;
long previousMillis = 0;
int x = 0;
long interval = 70;
long interval2 = 500;
int debounceIncrease;
int debounceDecrease;
Bounce increase = Bounce();
Bounce decrease = Bounce();
Bounce OK = Bounce();
void Alaarm() {
Menuposition == 1;
}
void alarmNoiseOn(){
unsigned long currentMillis = millis();
if(currentMillis - previousMillis > interval && x < 8) {
previousMillis = currentMillis;
if (toneOn == 0) {
toneOn = 2048;
}
else
toneOn = 0;
tone(9, toneOn);
if(toneOn == 0)
noTone(9);
x++;
}
if(currentMillis - previousMillis > interval2 && x == 8) {
previousMillis = currentMillis;
noTone(9);
x = 0;
}
}
void setup() {
lcd.begin(16, 2);
setTime(20,34,0,10,07,16); // set time to Saturday 8:29:00am Jan 1 2011
// create the alarms, to trigger at specific times
Alarm.alarmRepeat(20,35,0, Alaarm); // 8:30am every day
//Alarm.alarmRepeat(17,45,0,EveningAlarm); // 5:45pm every day
//Alarm.alarmRepeat(dowSaturday,8,30,30,WeeklyAlarm); // 8:30:30 every Saturday
// create timers, to trigger relative to when they're created
// Alarm.timerRepeat(15, Repeats); // timer for every 15 seconds
//id = Alarm.timerRepeat(2, Repeats2); // timer for every 2 seconds
//Alarm.timerOnce(10, OnceOnly); // called once after 10 seconds
Wire.begin();
pinMode(buttonIncrease, INPUT);
pinMode(buttonDecrease, INPUT);
pinMode(buttonOK, INPUT);
increase .attach(buttonIncrease);
increase .interval(10);
decrease .attach(buttonDecrease);
decrease .interval(10);
OK .attach(buttonOK);
OK .interval(10);
pinMode(alarmSpeaker, OUTPUT);
randomSeed(analogRead(2));
delay(1000);
}
void Clock() {
// digital clock display of the time
lcd.print(hour());
printDigits(minute());
printDigits(second());
lcd.println(" ");
}
void printDigits(int digits) {
lcd.print(":");
if (digits < 10)
lcd.print('0');
lcd.print(digits);
}
void loop() {
lcd.noDisplay();
lcd.display();
while (Menuposition == 0) {
lcd.setCursor(0, 0);
Clock();
Alarm.delay(1000); // wait one second between clock display
// Turn off the display:
lcd.noDisplay();
// Turn on the display:
lcd.display();
}
while(Menuposition == 1) {
lcd.noDisplay();
lcd.display();
alarmNoiseOn();
increase.update();
decrease.update();
int debounceIncrease = increase.read();
int debounceDecrease = decrease.read();
mathValOne = random(11, 15);
mathValTwo = random(9, 15);
mathValThree = random(20, 150);
inputAnswer = (mathValOne * mathValTwo + mathValThree) - random(5, 10);
realAnswer = mathValOne * mathValTwo + mathValThree;
lcd.setCursor(0, 0);
lcd.print(" Hello!"); // wakeup message
lcd.setCursor(0, 1);
lcd.print(mathValOne);
lcd.print("*");
lcd.print(mathValTwo);
lcd.print("+");
lcd.print(mathValThree);
lcd.print(" = ");
lcd.print(inputAnswer);
lcd.print(" ?");
delay(100);
if(debounceIncrease == HIGH) {
inputAnswer++;
}
if(debounceDecrease == HIGH) {
inputAnswer--;
}
if(digitalRead(buttonOK) == HIGH && inputAnswer != realAnswer) {
mathValOne = random(1, 10);
mathValTwo = random(1, 10);
mathValThree = random(1, 20);
}
if(digitalRead(buttonOK) == HIGH && inputAnswer == realAnswer) {
noTone(9);
delay(500);
lcd.noDisplay();
lcd.setCursor(0, 0);
lcd.print(" Good Morning!");
delay(5000);
Menuposition = 0;
mathValOne = 0;
mathValTwo = 0;
mathValThree = 0;
}
}
}