IRremoteESP8266 | Infrared remote library for ESP8266/ESP32 : send
kandi X-RAY | IRremoteESP8266 Summary
kandi X-RAY | IRremoteESP8266 Summary
This library enables you to send and receive infra-red signals on an ESP8266 or an ESP32 using the Arduino framework using common 940nm IR LEDs and common IR receiver modules. e.g. TSOP{17,22,24,36,38,44,48}* demodulators etc.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of IRremoteESP8266
IRremoteESP8266 Key Features
IRremoteESP8266 Examples and Code Snippets
Community Discussions
Trending Discussions on IRremoteESP8266
QUESTION
In the C file in simplesample_mqtt.c, which connects Arduino to the Azure IoT hub, I need to use the IRsend and IrRemoteESP8266 libraries to send an infrared signal with Azure IoT hub.
#include
#include
IRsend irsend(10); // An IR LED is controlled by GPIO pin 4 (D2)
I don't have any problem when I use this code in my main Ardunio file. But when I use these includes in a C file (implesample_mqtt.c), I get this error from line 3: "unknown type name 'IRsend'".
error full info : Arduino: 1.8.2 (Windows 10), Board: "NodeMCU 0.9 (ESP-12 Module), 80 MHz, 115200, 4M (3M SPIFFS)"
In file included from sketch\simplesample_mqtt.c:29:0:
C:\Program Files (x86)\Arduino\libraries\IRremoteESP8266\src/IRsend.h:29:1: error: unknown type name 'class'
class IRsend {
C:\Program Files (x86)\Arduino\libraries\IRremoteESP8266\src/IRsend.h:29:14: error: expected '=', ',', ';', 'asm' or 'attribute' before '{' token
class IRsend {
simplesample_mqtt.c:31: error: unknown type name 'IRsend'
IRsend irsend(10); // An IR LED is controlled by GPIO pin 4 (D2)
simplesample_mqtt.c:31: error: expected declaration specifiers or '...' before numeric constant
IRsend irsend(10); // An IR LED is controlled by GPIO pin 4 (D2)
exit status 1 unknown type name 'IRsend'
This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.
...ANSWER
Answered 2017-Aug-15 at 09:34I solved this problem. The reason for this is because main ardunio is c++ and simplesample_mqtt.c is c code and we have to use c++ code in c code :
i main ardunio file you have to declare function like this :
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install IRremoteESP8266
Enter IRremoteESP8266 into the "Filter your search..." top right search box.
Click on the IRremoteESP8266 result of the search.
Select the version you wish to install and click "Install".
Click on "Clone or Download" button, then "Download ZIP" on the page.
Extract the contents of the downloaded zip file.
Rename the extracted folder to "IRremoteESP8266".
Move this folder to your libraries directory. (under windows: C:\Users\YOURNAME\Documents\Arduino\libraries\)
Restart your Arduino IDE.
Check out the examples.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page