Notifications
Clear all

Determining Manufacture Codes IRReceiver demonstration 2.

4 Posts
3 Users
0 Likes
573 Views
(@enigmajd)
Member
Joined: 1 year ago
Posts: 9
Topic starter  

This is my first post.

When I use the following sketch, I get  case  error messages. "DISH was not delared in this scope".

I'm sure it is not too difficult to rectify and would appreciate a pointer in right direction

Enigma JD

/*
IR Receiver Demonstration 2
IR-Rcv-Demo2.ino
Determine IR codes manufacturer type with IR Receiver
Displays results on Serial Monitor
DroneBot Workshop 2017
http://dronebotworkshop.com
*/

// Include IR Remote Library by Ken Shirriff
#include <IRremote.h>

// Define sensor pin
const int RECV_PIN = 4;

// Define IR Receiver and Results Objects
IRrecv irrecv(RECV_PIN);
decode_results results;

void setup(){
// Serial Monitor @ 9600 baud
Serial.begin(9600);
// Enable the IR Receiver
irrecv.enableIRIn();
}

void loop(){
if (irrecv.decode(&results)){
Serial.println(results.value, HEX);
switch (results.decode_type){
case NEC:
Serial.println("NEC");
break;
case SONY:
Serial.println("SONY");
break;
case RC5:
Serial.println("RC5");
break;
case RC6:
Serial.println("RC6");
break;
case DISH:
Serial.println("DISH");
break;
case SHARP:
Serial.println("SHARP");
break;
case JVC:
Serial.println("JVC");
break;
case SANYO:
Serial.println("SANYO");
break;
case MITSUBISHI:
Serial.println("MITSUBISHI");
break;
case SAMSUNG:
Serial.println("SAMSUNG");
break;
case LG:
Serial.println("LG");
break;
case WHYNTER:
Serial.println("WHYNTER");
break;
case AIWA_RC_T501:
Serial.println("AIWA_RC_T501");
break;
case PANASONIC:
Serial.println("PANASONIC");
break;
case DENON:
Serial.println("DENON");
break;
default:
case UNKNOWN:
Serial.println("UNKNOWN");
break;
}
irrecv.resume();
}
}


   
Quote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6957
 

@enigmajd First look at the HELP to learn how to post code.

That kind of error is usually a missing library. Either re-read the article you are copying again to get the instructions or if you can't see it post a link to it here.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@davee)
Member
Joined: 3 years ago
Posts: 1674
 

Hi @enigmajd,

   Ron (@zander) is right in saying that it is much easier if you post code properly ... and I might add, I also appreciate web links to articles that you are relying on,

... but these are all things we learn about, occasionally by fortunately reading all the right stuff first, but usually by getting it wrong first time and fixing on the 2nd or 3rd attempt ... 🙄 🤔 

As a useful hint, before you hit ADD REPLY, use the Save Draft and Preview buttons just below the ADD REPLY button, to check if what will be posted looks the same as you hoping for ...

--------

The article you are using is Demonstration 2 on https://dronebotworkshop.com/using-ir-remote-controls-with-arduino/

I have only spent a few moments looking at this, and I haven't tried doing it myself, but my first thought would be the compiler hasn't found the include file, referenced at about line 8:

// Include IR Remote Library by Ken Shirriff
#include <IRremote.h>

If my guess is right, you should see an error message to that effect ... hopefully (but not necessarily) it will be the first error message, as errors are usually reported as the compiler reads through the program file.

If there is an error message indicating it couldn't find the .h file, the most likely reason is something went wrong when you tried to install that library, which Bill describes as part of the introduction to Demonstration 1. I would recommend you carefully go back through that part of the set up and try again, taking particular note of what Bill says in the video, and also in the accompanying text on this website. A common mistake with Arduino libraries is to choose the wrong library ... there are sometimes more than one with rather similar descriptions.

------

On a good day, you will find the problem on a second attempt ... but most days life isn't that kind, so please have a go and report what you find.

If you still have errors, paste that as well (maybe screenshot if it doesn't let you copy and paste) ... if it is a long listing, then just the first 2 or 3 error messages is often enough.

Good luck,

Dave


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6957
 

@enigmajd In Bill's article it says (SEE ATTACHED PIC1) and I highlight the part that goes

look for “IR Remote by Shirriff” 

which will result in PIC2.

Screenshot 2023 01 18 at 10.34.47
Screenshot 2023 01 18 at 10.35.44

 

 

 

 

 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote