}
}



void playSong() {
  for(int i = 0; i<length;++i) {
  if(notes[i]==' ') {delay(beats[i]*tempo);//beats[i]
  } else {
    playNote(notes[i],beats[i]*tempo);//
 }
 }
}


LCD4Bit_mod lcd = LCD4Bit_mod(2); 

//Key message
char msgs[5][15] = {"Right Key OK ", 
                    "Up Key OK    ", 
                    "Down Key OK  ", 
                    "Left Key OK  ", 
                    "Select Key OK" };
int  adc_key_val[5] ={30, 150, 360, 535, 760 };
int NUM_KEYS = 5;
int adc_key_in;

int key=-1;
int oldkey=-1;
int oldvalue = 0;
Ejemplo n.º 2
0
// D8 (PB0) LCD RS
//~D9 (PB1) LCD E
//~D10(PB2) LCD Backlight ctr
//~D11(PB3) PWM for heat lamp
// D12(PB4) Power ON sensor
// D13(PB5) Alarm buzzer
// A0 (PC0) Keys sensor
// A1 (PC1) Light sensor
// A2 (PC2) Debug LED
// A3 (PC3)
// A4 (PC4) RTC SDA
// A5 (PC5) RTC SCL

OneWire oneWire = OneWire(2); // D2
DS1307 RTC = DS1307();
LCD4Bit_mod LCD = LCD4Bit_mod();
KeyPad KEYS = KeyPad(A0);
Alarm ALARM = Alarm();
TempManager TEMP = TempManager(oneWire);
UIManager UI = UIManager();
System SYSTEM = System();
EpromManager EEPROM = EpromManager();

//////////////////////////////////////////////////////////////////////////

byte range_cycle(byte min, byte max, byte val)
{
  if(val > max) return min;
  if(val < min) return max;
  return val;
}