void setup() { // debugging channel Serial1.begin(57600); while (!Serial1) { delay(100); } Serial1.print( "RAM at setup " ); Serial1.println( freeRam() ); // ALRAM pinMode(ALARM_LED_PIN, OUTPUT); digitalWrite( ALARM_LED_PIN, LOW ); // must "begin" the button to get proper pin assignment/muxing b.begin(); // initializing ADC channels. The channels 0...7 are assigned to the // pins A0...A7. Note that the display and the config.txt files, as well as // the shield's silk layer use enumeration 1 to 8 ADCs[0] = AdcChannel(A0); ADCs[1] = AdcChannel(A1); ADCs[2] = AdcChannel(A2); ADCs[3] = AdcChannel(A3); ADCs[4] = AdcChannel(A4); ADCs[5] = AdcChannel(A5); ADCs[6] = AdcChannel(A6); ADCs[7] = AdcChannel(A7); // initializing actuators. The Id is 0 to 7, a bit number in // actuator byte of the ADC channel. The mapping to the pin is // pin = A8 + Id Actuators[0] = Actuator(0, true); Actuators[1] = Actuator(1, true); Actuators[2] = Actuator(2, true); Actuators[3] = Actuator(3, true); Actuators[4] = Actuator(4, true); Actuators[5] = Actuator(5, true); Actuators[6] = Actuator(6, true); Actuators[7] = Actuator(7, false); // the last actuator is not connected through ULN2003 but directly // The Real Time Clock rtc.begin(); // returns bool, but is never false Serial1.print( "RAM after rtc.begin " ); Serial1.println( freeRam() ); if(rtc.isrunning()) Serial1.println("RTC is running"); else { Serial1.println("RTC is NOT running"); rtc.adjust(DateTime(__DATE__, __TIME__)); // setup the current date and time initially } DateTime now = rtc.now(); Serial1.print(now.year(), DEC); Serial1.print('/'); Serial1.print(now.month(), DEC); Serial1.print('/'); Serial1.print(now.day(), DEC); Serial1.print(" ("); Serial1.print(daysOfTheWeek[now.dayOfTheWeek()]); Serial1.print(") "); Serial1.print(now.hour(), DEC); Serial1.print(':'); Serial1.print(now.minute(), DEC); Serial1.print(':'); Serial1.print(now.second(), DEC); Serial1.println(); // activate LCD module lcd.begin (16,2); // for 16 x 2 LCD module lcd.setBacklightPin(3,POSITIVE); lcd.setBacklight(HIGH); Serial1.print( "RAM after lcd.begin " ); Serial1.println( freeRam() ); if(!Store.begin()) { Serial1.println("Error initializing the storage"); digitalWrite( ALARM_LED_PIN, HIGH ); } Serial1.print( "RAM after Storage.begin " ); Serial1.println( freeRam() ); // the below makes sure the 1st active item is displayed upon start up. Otherwise // the item 0 is displayed, even if inactive Store.mIndex = CHANNEL_COUNT-1; Store.Advance(); }