Hello,
I have connected Arduino UNO via shield with uLCD-70DT. Everything worked fine for couple days but know I noticed strange behavior. After about 5 to 10 minutes arduino slows down and communication with uLCD is broken. I tried many options I also changed arduino, but problem is still the same after 5 minutes of working fine I have to reset arduino to restart communication and repeat it after next 5 minutes. While communication is broken Arduino remember last position of Iswitches and repeat loop but 3 times slower, IMediaLed1 doesn't flash what is the first symptom that arduino doesn't communicate with uLCD. Arduino also doesn't react when I change position of switches. I have no idea what could make such a strange behaviour.
Arduino code:
Regards
I have connected Arduino UNO via shield with uLCD-70DT. Everything worked fine for couple days but know I noticed strange behavior. After about 5 to 10 minutes arduino slows down and communication with uLCD is broken. I tried many options I also changed arduino, but problem is still the same after 5 minutes of working fine I have to reset arduino to restart communication and repeat it after next 5 minutes. While communication is broken Arduino remember last position of Iswitches and repeat loop but 3 times slower, IMediaLed1 doesn't flash what is the first symptom that arduino doesn't communicate with uLCD. Arduino also doesn't react when I change position of switches. I have no idea what could make such a strange behaviour.
Arduino code:
Code:
#include <genieArduino.h> #define RESETLINE 4 //#include <avr/wdt.h> Genie genie; const int toggle_relay_1 = 14; const int toggle_relay_2 = 15; const int toggle_relay_3 = 16; const int toggle_relay_4 = 17; bool ledState_1 = LOW; bool ledState_2 = LOW; bool ledState_3 = LOW; bool ledState_4 = LOW; bool led_signal = LOW; unsigned long previousMillis = 0; const long interval = 3000; unsigned long currentMillis = 0; unsigned long previousMillis_1 = 0; const long interval_1 = 2000; unsigned long currentMillis_1 = 0; bool switch_4; bool switch_5; bool switch_6; bool switch_7; void setup() { // wdt_enable(WDTO_4S); // pinMode (slaveSelectPin, OUTPUT); // pinMode (slaveSelectPin_1, OUTPUT); // set the shutdownPin as an output: // pinMode (shutdownPin, OUTPUT); pinMode (toggle_relay_1, OUTPUT); pinMode (toggle_relay_2, OUTPUT); pinMode (toggle_relay_3, OUTPUT); pinMode (toggle_relay_4, OUTPUT); genie.Begin(Serial); genie.AttachEventHandler(myGenieEventHandler); pinMode(RESETLINE, OUTPUT); digitalWrite(RESETLINE, 1); // Reset the Display via D4 delay(100); digitalWrite(RESETLINE, 0); // unReset the Display via D4 delay (2500); genie.WriteContrast(10); // About 2/3 Max Brightness delay(500); } void loop() { // wdt_reset(); currentMillis = millis(); currentMillis_1 = millis(); genie.ReadObject(GENIE_OBJ_ISWITCH, 4); genie.ReadObject(GENIE_OBJ_ISWITCH, 5); genie.ReadObject(GENIE_OBJ_ISWITCH, 6); genie.ReadObject(GENIE_OBJ_ISWITCH, 7); genie.DoEvents(); if (switch_4 ==1){ genie.WriteObject(GENIE_OBJ_PINOUTPUT,1 ,1); } else{ genie.WriteObject(GENIE_OBJ_PINOUTPUT,1 ,0); } if (switch_5 ==1){ genie.WriteObject(GENIE_OBJ_PINOUTPUT,3 ,1); } else{ genie.WriteObject(GENIE_OBJ_PINOUTPUT,3 ,0); } if (switch_6 ==1){ genie.WriteObject(GENIE_OBJ_PINOUTPUT,5 ,1); } else{ genie.WriteObject(GENIE_OBJ_PINOUTPUT,5 ,0); } if (switch_7 ==1){ genie.WriteObject(GENIE_OBJ_PINOUTPUT,7 ,1); } else{ genie.WriteObject(GENIE_OBJ_PINOUTPUT,7 ,0); } if (currentMillis - previousMillis >= interval) { //Zapamietaj aktualny czas previousMillis = currentMillis; //Zmieniamy stan diody na przeciwny if (switch_4 == 1){ ledState_1 = !ledState_1; //ustawiamy nowy stan na diodzie digitalWrite(toggle_relay_1, ledState_1); } if (switch_5 == 1){ ledState_2 = !ledState_2; //ustawiamy nowy stan na diodzie digitalWrite(toggle_relay_2, ledState_2); } if (switch_6 == 1){ ledState_3 = !ledState_3; //ustawiamy nowy stan na diodzie digitalWrite(toggle_relay_3, ledState_3); } if (switch_7 == 1){ ledState_4 = !ledState_4; //ustawiamy nowy stan na diodzie digitalWrite(toggle_relay_4, ledState_4); } } if (currentMillis_1 - previousMillis_1 >= interval_1) { //Zapamietaj aktualny czas previousMillis_1 = currentMillis_1; led_signal = !led_signal; //Zmieniamy stan diody na przeciwny genie.WriteObject(46, 1 , led_signal); } } void myGenieEventHandler(void) { genieFrame Event; genie.DequeueEvent(&Event); if (genie.EventIs(&Event, GENIE_REPORT_EVENT, GENIE_OBJ_ISWITCH, 4)) { switch_4 = genie.GetEventData(&Event); } if (genie.EventIs(&Event, GENIE_REPORT_OBJ, GENIE_OBJ_ISWITCH, 4)) { switch_4 = genie.GetEventData(&Event); } if (genie.EventIs(&Event, GENIE_REPORT_OBJ, GENIE_OBJ_ISWITCH, 5)) { switch_5 = genie.GetEventData(&Event); } if (genie.EventIs(&Event, GENIE_REPORT_EVENT, GENIE_OBJ_ISWITCH, 5)) { switch_5 = genie.GetEventData(&Event); } if (genie.EventIs(&Event, GENIE_REPORT_OBJ, GENIE_OBJ_ISWITCH, 6)) { switch_6 = genie.GetEventData(&Event); } if (genie.EventIs(&Event, GENIE_REPORT_EVENT, GENIE_OBJ_ISWITCH, 6)) { switch_6 = genie.GetEventData(&Event); } if (genie.EventIs(&Event, GENIE_REPORT_OBJ, GENIE_OBJ_ISWITCH, 7)) { switch_7 = genie.GetEventData(&Event); } if (genie.EventIs(&Event, GENIE_REPORT_EVENT, GENIE_OBJ_ISWITCH, 7)) { switch_7 = genie.GetEventData(&Event); } }
Comment