/* * Initialize the application. */ void setup() { #if DBG_RTC rtc.Ds3231Init(); // Initialize Ds3231 // WriteInitTime(); // Comment in, if you want setup the RTC TIME/Calendar // SetRTCAlarm(); // Comment in, if you want to set the Alarm1|2 #endif #if DBG_LUX bh.BH1750Init(); // Initialize BH1750 #endif #if DBG_DHT dht.DHTInit(PIO2_2, DHT22); // Use the DHT22 sensor on PIN #endif /* if(I2C::Instance()->bI2CIsInitialized) { // I2CScan I2C::Instance()->I2CScan(); // check .I2CScan_State ans .I2CScan_uAdress } */ // LED Initialize pinMode(PIO2_6, OUTPUT); // Info LED (yellow) pinMode(PIO3_3, OUTPUT); // Run LED (green) pinMode(PIO2_0, OUTPUT); // Prog LED (red) // LED Set Initial Value (ON|OFF) digitalWrite(PIO3_3, 0); // Info LED (yellow) // Will be toggled with dht function (blink on read success) digitalWrite(PIO2_6, 0); // Run LED (green) // Will be toggled with LUX function (off if Lux == 0) digitalWrite(PIO2_0, 1); // Prog LED (red) // Will be toggled with rtc function enableInterrupt(TIMER_32_0_IRQn); // Enable the timer interrupt timer32_0.begin(); // Begin using the timer timer32_0.prescaler((SystemCoreClock / 1000) - 1); // Let the timer count milliseconds timer32_0.matchMode(MAT1, RESET | INTERRUPT); // On match of MAT1, generate an interrupt and reset the timer timer32_0.match(MAT1, READ_TIMER); // Match MAT1 when the timer reaches this value (in milliseconds) timer32_0.start(); // Start now the timer }
/* * Initialize the application. */ void setup() { dht.DHTInit(PIO2_2, DHT22); // Use the DHT22 sensor on PIN //dht1.DHTInit(PIO0_7, DHT22); // Use the DHT22 sensor on PIN // LED Initialize pinMode(PIO2_6, OUTPUT); // Info LED (yellow) pinMode(PIO3_3, OUTPUT); // Run LED (green) pinMode(PIO2_0, OUTPUT); // Prog LED (red) // LED Set Initial Value (ON|OFF) digitalWrite(PIO3_3, 0); // Info LED (yellow) digitalWrite(PIO2_6, 0); // Run LED (green) // Will be toggled with dht function (blink on read success) digitalWrite(PIO2_0, 1); // Prog LED (red) enableInterrupt(TIMER_32_0_IRQn); // Enable the timer interrupt timer32_0.begin(); // Begin using the timer timer32_0.prescaler((SystemCoreClock / 1000) - 1); // Let the timer count milliseconds timer32_0.matchMode(MAT1, RESET | INTERRUPT); // On match of MAT1, generate an interrupt and reset the timer timer32_0.match(MAT1, READ_TIMER); // Match MAT1 when the timer reaches this value (in milliseconds) timer32_0.start(); // Start now the timer }