iregon / arduino-tvout

Automatically exported from code.google.com/p/arduino-tvout
0 stars 0 forks source link

Problem with IrRemot #75

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hello,
I want to print information on the Tv since I receive information from a Ir 
Remote so i use this code :

#include <IRremote.h>
#include <TVout.h>
#include <fontALL.h>
#include <Time.h>

TVout TV;
int RECV_PIN = 13;
IRrecv irrecv(RECV_PIN);
decode_results *results;
unsigned int code;
int lampe1 = 0;
int lampe2 = 0;
int lampe3 = 0;
long temps1 = 0;
long temps2 = 0;
int temperature1 = 0;
int lumiere1 = 0;
long interval = 3000;
int alarme = 1;
int heurealarme = 7;
int minutealarme = 30;
int alarmewe = 0;
int changealarme = 0;

void setup(){
  pinMode(22, OUTPUT);
  pinMode(23, OUTPUT);
  pinMode(24, OUTPUT);
  irrecv.enableIRIn();
  TV.select_font(font4x6);
  setTime(19,29,30,02,11,2013);
  TV.begin(PAL);

}

 void loop(){

    if(irrecv.decode(results)){
    code = results->value;
    TV.println(code);
    switch (code) {
      case 34425:
      if (lampe1 == 0) {
        digitalWrite(23, HIGH);
         lampe1 = 1;         
      }
      else {
        digitalWrite(23, LOW);
         lampe1 = 0;
      }
      break;     
    }
    irrecv.resume();
  }

     temps1 = millis();
   lumiere1 = analogRead(A0);
   temperature1 = analogRead(A3);  
 if(temps1 - temps2 > interval){

    TV.clear_screen();
    TV.print("temperature =  ");
    TV.println(temperature1);
    TV.print("Lumiere =  ");
    TV.println(lumiere1);
    TV.print(hour());
    TV.print(":");
    TV.println(minute());
    TV.println(lampe1);
    temps2 = temps1;
    if (alarme == 1){
      TV.print("alarme activee ");
      if(alarmewe == 1){
        TV.println("toute la semaine");
      }
      else{
        TV.println("de lundi a vendredi");
      }  
    }
    else{
      TV.println("alarme desactivee");
    }

   }

    if (alarme == 1){
    if (alarmewe = 0 && weekday() != 7 && weekday() != 1){
      if (hour() == heurealarme){
        if (minute() >= minutealarme){
          if (lampe2 == 0){
            digitalWrite(24, HIGH);
            lampe1 = 1;
          }
          else{
            digitalWrite(24, LOW);
            lampe1 = 0;
          }  
        } 
      }
    }
    else{
      if (hour() == heurealarme){
        if (minute() >= minutealarme){
          if (lampe2 == 0){
            digitalWrite(24, HIGH);
            lampe1 = 1;
          }
          else{
            digitalWrite(24, LOW);
            lampe1 = 0;
          }
        }
      }
    }
  }
 }

When I upload the program, there is no compilation error and the Tv out work 
properly but the arduino mega can't receive Ir information. When I open the 
seriial monitor the Tv outup reset. Who can I use the two librairie in the same 
program ? 

Thank you

Original issue reported on code.google.com by francois...@gmail.com on 2 Nov 2013 at 9:06

GoogleCodeExporter commented 9 years ago
I am also interested in this since I am trying to control my tvout project via 
infrared. I am using an Arduino Uno R3 though

Original comment by leonh.Go...@googlemail.com on 9 Jul 2014 at 9:57