⬆️ ⬇️

Remote service block multifunction BDS-M

On this joyful note, I complete the story of the current configuration of the Convenient Home. The last part of the system in my secret plans was always held under the code "media controller". And, naturally, it was intended to control the TV, media player and air conditioning from a smartphone or any computer with an Internet browser. The functional, as always, was supplemented and developed on the move - I, it seems, just have some kind of pernicious passion for improvisation.



Therefore, from a simple repeater of IR commands, the media controller turned into a not very simple one. At first I added an atmospheric pressure sensor there to complete the picture of meteorological data. And then - a radio signal repeater from wireless sensors, which somewhat simplified the life and use of some functions of the central controller. More specifically, it turned out almost trouble-free control of the cat feeder.



So that there is no misunderstanding: I did not see any special purpose or need for this controller. It was just interesting to do it and at the same time to take long winter evenings with something except looking thoughtfully out the window, drinking coffee and reflecting on the eternal, always under a warm checkered rug.

')

One of the current practical applications (which had to be abandoned) is the simultaneous activation of the wireless keyboard of the TV with one button and the launch of the file manager on the Android keychain connected to the TV to watch something. The second application, which I think about, but which, most likely, will also be sent to the furnace - automatic control of air conditioning, depending on the temperature in the room.



Probably better about everything in order.







Other devices and devices of the series
My comfortable home

The controller is a central home, all-powerful KCD-V-2-12

The device of feeding of cats operated, passive AKK-PU-1

Instrument measuring temperature and humidity PI-TV-2

Automatic light and music ASIM-AU-2-6







. and antenku so in hand: zyrk-zyrk

image



Purpose and functions


The media controller is designed to work in conjunction with the central controller.



When functionality is limited, autonomous operation is possible in conjunction with a radio remote control that is capable of issuing commands using a compatible protocol with a fixed code for each button (as a rule, consoles from simple radio sockets, radio relay, light switches).



Implemented functions (C - with central controller; A - possible in standalone mode):



1) LG TV Management (C, A)

2) G-mini HDR900D media player control (C, A)

3) Controlling the air conditioner LG CS12AQ (C, A)

4) Retransmission of commands of radio controls and signals of wireless sensors to the central controller (C)

5) Measurement and transfer to the central controller of the values ​​of atmospheric pressure and room temperature (C)



Background


The basic idea of ​​the media controller was as follows. It receives radio commands from the central controller and transmits the corresponding command, but already through the IR diode. Of course, the media controller should be located in relative proximity to the controlled devices, and direct visibility between the IR diode and the IR receiver of the controlled equipment is simply a prerequisite.



I got the IR commands for the devices in a primitive way: I assembled a small stand from the IR receiver and the Arduino from the IRremote library. The peculiarity of the library is that it recognizes a lot of protocols and in many cases confidently "reads" the control codes of IR remotes. In this, it is very similar to RC-Switch: we receive codes once, and then use them in any of our devices.



In case the code is not recognized, there is a “raw” sequence of pulse durations, which IRremote issues along with the control code. The downside, however, is that this option is much more wasteful in terms of controller resources. But if it is necessary here and now, there is no alternative, in general.



Application found both ways. It just so happened that there were no problems with TV and media player, and the air conditioner capricious. Reading the stories of comrades discovered the terrible truth: the code word of the air conditioner team contains absolutely all information about the operating mode being installed.



Taming the air conditioner


The average air conditioner is a pretty stupid and docile creature. He remembers nothing, knows nothing, and only does what the world behind the scenes remote control says.



To understand that this is an option when you need to use raw code is quite simple. For example, if an unlimited number of times to press the same button on the remote control from the TV, the command will be the same each time. And this command can be used anywhere.



But if you press, suppose, the button to increase the temperature on the air conditioner remote control, then the command within the temperature range will be different each time. This is because the set temperature is transmitted in the code word, and not a sign of its change. Also in the code word are transmitted: mode of operation (cold / heat / fan), fan speed, the position of the blinds, etc. It is clear that if you use the “decoded” result from IRremote, it will not end with anything good, because it has nothing to do with reality.



Another problem is that the features and functions of air conditioners are constantly changing - from generation to generation, from model to model. Therefore, even if it occurred to someone to write their own library for any brand, at best, the functionality (and at worst, performance) would be limited to the functions of the model, which was taken as a basis.



Here is an example: a person has an air conditioner without automatic control of vertical blinds. And how could he know (if he did not see the original protocol) that in the code word some pair of bytes is responsible for managing the vertical blinds? If you want my opinion - from nowhere. After all, even if the code word has a reserve for new commands, it is impossible to understand exactly what they are doing - maybe ionization is included. Or maybe air drying. This, you know, a squiggle.



However, heroes exist. A friend here wrote his library for air conditioners LG .



Well, after a little reflection on whether it was necessary to somehow calculate the logic of building air conditioner commands, I came to the conclusion that there is no urgent need. The fact is that we use a rather limited set of functions: as a rule, the same heating temperature and the same cooling temperature. Therefore, I decided not to waste time on the implementation of everything and everything, but simply consistently installed in the console and read the commands of current modes: on, off, heating and cooling.



So, it seems to be order, but it turns out that I spend one microcontroller for one function. It was also wasteful, so I thought a little and decided that if this was so, then why not measure atmospheric pressure at the same time, since the external meteo sensor is deprived of it. Thus, the popularly favorite sensor BMP085 was added to the controller.



Atmospheric surprise


An interesting story is connected with the BMP085 sensor. First, I learned about the existence of two versions with voltage of 3V and 5V only after I had not only ordered, but also received my own copy. Moreover, on the board, which is typical, they do not write what kind of voltage this sensor needs. I had to look at the photos of different sensors and, ultimately, take a chance.



Secondly, when ordering, I was absolutely sure that I was buying an atmospheric pressure sensor. After all, everywhere BMP085 is presented in this way. Therefore, I was very surprised when, after receiving it, I read the sensor specifications, and I saw “Temperature measurement included” there. And then the details are " -40 to + 85 ° C operational range, + -2 ° C temperature accuracy ".



It turned out that you can measure both pressure and temperature at the same time. And the accuracy was fine with me, especially since this is such a nice bonus.



I’ll say right away that I didn’t compare the readings with a standard thermometer, so I can’t say how much and in what direction the error is (if it’s wrong at all) the sensor.



. On sober reflection, I took the sensor out of the case so as not to think that the heating of the microcontroller will somehow affect the temperature measurement. And this is necessary, how dusty it is already!

image



Repeater


The idea of ​​the third function was born somehow by itself when I was confronted with the fact that the central controller did not hear very well the radio button that activates the cat feeder. It was generally assumed that we would press the button at night without opening the eyes, and ideally - without waking up. The reality made its own corrections: it was necessary to stretch the arm upwards, turn the button with different sides and press several times.



This is generally strange, since the button was from the Chinese burglar alarm, and they have quite harsh transmitters, which are distinguished by a decent range.



And here the current location of the media controller turned out to be very successful - just halfway between the radio button and the central controller, to which, in fact, the signal was assigned. The solution is as follows: the media controller listens to the radio, and if it encounters a familiar command, it re-radiates it.



The problem with conflicts is solved quite simply. First, the central controller may have time to react to the first word in the frame of the radio button command. And after that, he doesn’t care who or what re-emits. In addition, the media controller repeater, as a rule, completes the transfer of the command after the radio button, which also makes it possible to receive an undistorted signal.



I understand that it sounds doubtful. And the implementation is also somehow not very. But in practice we forgot about the problems with the radio button. Now it works always and without any ridiculous arms waving there.



Well, in the wake of success, I also added the retransmission of wireless sensor signals (leaks and smoke) - just in case. It is not difficult for me, and if it helps - why not?



Principle of operation


In general, the media controller is designed to work together with the central controller. Autonomous work is a rather exotic application that requires a multi-button radio remote control and limits functionality.



Therefore, I will talk about the interaction with the central controller.



Relay IR commands


For any IR control command, several conditions must be met:



1) A table of correspondences of network (web) control radio and IR commands should be compiled

2) Network (web) commands and control radio commands should be described in the central controller

3) In the media controller, control radio commands and their corresponding IR commands should be described



Management occurs according to the scheme:



1) The user dials (presses the button on the smartphone) network (web) command in the browser

2) The central controller processes the network (web) command and issues the appropriate radio command.

3) The media controller receives a radio command and sends the corresponding IR command to the IR diode



Network (web) commands are normal HTTP POST requests (in a primitive form - the address in the browser string). For example:



192.168.22.185/?TVON



Here " 192.168.22.185 " is the controller's address, and "TVON" is the command. Accordingly, we invent the teams ourselves based on fantasy and common sense.



Radio commands follow from the RC-Switch protocol, which allows you to transmit 24-bit digital codes, that is, numbers from 0 to 16777216. Ie You can choose any, provided that they do not duplicate codes that you can already use or that are “flying” nearby (from neighbors, for example).



You can find out what is happening next to you in two ways: firstly, by the inadequate behavior of your equipment, and, secondly, if you assemble a simple receiving stand from the Arduino, ASK / OOK receiver at the selected frequency (315 or 433 MHz) and the RC library -Switch (example ReceiveDemo_Simple).



IR commands of your technology can be found using the IRremote library.



Confirmation of the reception and execution of radio commands by the media controller is not provided.



Transfer of atmospheric pressure and room temperature


To transfer these indicators, I use the same RC-Switch library and the same technique as in the weather sensor. That is, the controller periodically (once in half an hour) measures the values ​​and transmits them to the central controller over the air in the form of a numeric code.



The difference from the weather sensor is only in the fact that here I was too lazy and singled out a separate group for each indicator.



As a result, the pressure is transmitted by the type code 1210XXXX, where XXXX is the integer part of the pressure value (I am not very interested in hundredths) in mPa. Recalculation in mmHg performs the central controller, do not ask why. I dont know.



The temperature is transmitted by the type code 1310YXXX, where XXX is the temperature value multiplied by 10 (tenths of the same way are transmitted), and Y is the sign of temperature (0 is positive, 1 is negative). Also do not ask why you need a sign for room temperature.



Both values ​​are transmitted one after another with a small interval.



Confirmation of the receipt of commands by the central controller is not provided.



Radio Repeater


This service function is implemented elementarily with the help of RC-Switch. It is enough to define the retransmitted codes and list them in the media controller. These may be radio socket codes or switches, to which the central controller "does not reach". Or sensors that the central controller "does not hear."



Thus, if the media controller recognizes the retransmitted code (the button is pressed, the sensor has been triggered, the command has been transmitted), then it simply repeats it a specified number of times.



The only peculiarity is that, in my implementation, the signals of “non-permanent” sensors, that is, for example, remote controls, are relayed immediately, and the signals of sensors that constantly signal (for example, leakage or smoke) are relayed cyclically and with some delay.



The logic is as follows. It is believed that the central controller (CC) always hears the multimedia controller (MC), which is ensured by their mutual arrangement. At the same time, the retransmission of the periphery signal through the MC is guaranteed to be completed later than the signal transmission by the initiator is completed.



Therefore, on the one hand, the Central Committee is guaranteed to receive a retransmitted signal, even if it does not hear the initiator, and on the other, it will receive a command even if both the initiator and the MC receive it at the same time.



Only the specifics of constantly beeping sensors remain. As I said, the leak sensor can scream all the time while it’s in the water, and until the batteries sit down. He will be silent only when conditions return to normal. Therefore, MK, firstly, begins to retransmit its signal after a 5-second pause (this is in case the Central Committee itself hears the sensor) and, secondly, it repeats this cycle as long as the initiator signals. Those. MK as if "singing."



Confirmation of the receipt of commands by the central controller is not provided.



Iron


I understand that I'm tired, but I remind you - the set for the current configuration, links for example. So:



1) Arduino Pro Mini (ATmega328p, 16 MHz, 5V)

2) 433 MHz ASK / OOK receiver and transmitter set

3) IR513B-40 IR LEDs (940 nm) (2 pieces) or similar

4) Current-limiting resistor for LEDs (ideally 68 ohms)

4) Sensor BMP085 (version 5B)

5) Wire for placement of LEDs, power, switching, connectors and layout wires to taste

6) Case

7) Power supply



You will also need a photo receiver to read the signals of the IR remotes, if you want to control any AV equipment. I used TSOP4836 for this purpose (receiver-demodulator with the most common modulation frequency of 36 kHz). The peculiarity of this figoviny is that if you do not cover up the back side with something, then there is a huge amount of interference. Keep in mind, or buy something shielded right away.



The assembly scheme here from the sketch is not quite obvious, because three of the four components are connected to the “default” pins - these are the LEDs, the receiver and the BMP085 sensor. But the transmitter pin, in principle, you can choose for yourself - just do not forget to fix it in the code later.



1) Receiver



DATA - to digital pin 2

VCC - to power + 5V

GND - to the ground



2) Transmitter



DATA - to digital pin 6

VCC - to power + 5V

GND - to the ground



3) BMP085

According to Adafruit instructions :



SCL - to analog pinu 5

SDA - to analog pinu 4

VCC - to power + 5V (only for version 5B, otherwise - 3.3V)

GND - to the ground



4) IR diodes



Both are connected in series. Only one wire is shorter - it looks at the TV, and the other has a longer one - it needs to get into the air conditioner.



Sorry, I confuse the anode and the cathode all the time. In general, one side - to the ground (cathode?), And the other (anode?), Through a current-limiting resistor (I have a pair of 180 Ohms, that is, 90 Ohms) on a digital pin 3 (this is the default library but will not work on Mega, which will require modification of the library code (keep in mind).



My resistance is, to be honest, wrong. But there were no others at hand, and it was scary to put three in parallel, since the calculated current could be higher than the Arduino's capabilities, but I did not want to check.



You can calculate current limiting resistance yourself and for your number of diodes in a convenient calculator .



I stuffed all this happiness (literally) in a small box. Oh yes, do not forget the antenna for the receiver and transmitter, if they are not. If you have nothing at all, you can cut the wire into a quarter wave (173 mm or 164 mm).



At first, the BMP085 sensor was inside, but then I realized that it could additionally heat up there, and indeed, and brought it out. Not very aesthetic, but the temperature should be measured a little more accurately.



. connectors: power supply and for connecting LEDs. For the latter - the usual mono 2.5 mm jack

image



Soft


The sketch requires the following non-standard libraries:



1) RC-Swtich for data exchange and relaying of signals.

2) IRremote for controlling AV technology with IR remotes.

3) Adafruit_BMP085 to receive data from the BMP085 sensor.

4) SimpleTimer for counting time intervals.



For work you will need:



1) Enter the codes of their radio commands for relaying.

2) Enter the IR codes of the controlled devices.

3) Enter the codes of radio commands for which the multimedia controller will issue IR commands.

4) Customize the multimedia controller command section to taste in the central controller code (for control via the Internet).



It is assumed that you already know the radio command codes for relaying (these are your wireless sensors, consoles, etc.). If you do not know, use Arduino, the receiver and the RC-Switch library with the ReceiveDemo_Simple example.



You can learn the infrared codes of the controlled devices either from the tablets, which in a variety are walking on the Internet, or by reading them from the consoles. For the second case, you will need to connect the photodetector to the Arduino and use the IRremote library. If you hurry, remember the main thing:



1) If, when you press the same button, you get different values, it means that something went wrong, or you have a remote control from an air conditioner. In this case, it makes sense or look for the appropriate control library. Or, if there is none, simply use the “raw” codes, as I did in the variables section, packing everything into PROGMEM.



Remember that in the "raw" codes, the first value, clearly falling out of the row, should be discarded manually.



2) If by pressing the same button you get the same code - you can safely use it. Just do not forget that IRremote also has its own transfer format, and in addition to the command code, you also need to specify in which command system the transfer takes place. I have NEC.



But the code itself.
// 28.10.2013 -        // 29.11.2013 -        #include <Wire.h> #include <Adafruit_BMP085.h> #include <RCSwitch.h> // http://code.google.com/p/rc-switch/ #include <SimpleTimer.h> // #include <IRremote.h> unsigned long myData; long aL; boolean water1=false; //        boolean water2=false; boolean water3=false; boolean smoke1=false; boolean smoke2=false; boolean smoke3=false; #define txPin 6 //   SimpleTimer checkWeather; //   RCSwitch meteoSwitch = RCSwitch();  RC-Switch IRsend irsend; //  IRRemote //    PROGMEM const prog_uint16_t acON[59] PROGMEM ={9450, 4350, 650, 1600, 600, 500, 550, 550, 550, 500, 600, 1600, 600, 500, 600, 500, 600, 500, 600, 500, 600, 500, 600, 500, 600, 500, 600, 500, 600, 500, 600, 500, 600, 500, 550, 1650, 600, 500, 600, 1600, 550, 1650, 600, 500, 550, 550, 600, 500, 550, 550, 600, 1600, 600, 450, 600, 1600, 600, 1600, 600}; const prog_uint16_t acOFF[59] PROGMEM ={9550, 4300, 600, 1600, 650, 450, 650, 450, 600, 500, 650, 1550, 600, 500, 600, 500, 600, 500, 600, 1600, 600, 1600, 600, 500, 600, 500, 600, 500, 600, 500, 600, 500, 600, 500, 500, 600, 600, 500, 600, 500, 600, 450, 650, 450, 600, 1600, 650, 450, 600, 1600, 650, 450, 600, 500, 600, 500, 650, 1550, 600}; const prog_uint16_t acCool[59] PROGMEM ={9500, 4350, 600, 1650, 600, 500, 600, 500, 600, 500, 600, 1550, 600, 500, 600, 500, 600, 500, 600, 500, 600, 500, 600, 500, 600, 500, 550, 1650, 600, 500, 600, 1600, 600, 1600, 600, 500, 600, 1600, 600, 500, 600, 500, 600, 500, 600, 500, 600, 500, 600, 500, 600, 1600, 600, 1550, 600, 1600, 600, 1600, 600}; const prog_uint16_t acHeat[59] PROGMEM ={9500, 4350, 600, 1600, 650, 450, 650, 450, 650, 450, 600, 1600, 600, 500, 600, 500, 600, 500, 600, 500, 600, 500, 600, 500, 600, 500, 600, 1600, 600, 500, 600, 1550, 650, 1550, 600, 1600, 650, 1550, 650, 450, 650, 1550, 600, 500, 600, 500, 600, 500, 650, 450, 650, 1550, 600, 500, 600, 500, 600, 500, 600}; //     PROGMEM const prog_uint16_t *IRRemotePointer[] = { acON, acOFF, acCool, acHeat}; Adafruit_BMP085 bmp; //  BMP085 void setup() { pinMode(13, OUTPUT); //  bmp.begin(); meteoSwitch.enableTransmit(txPin); // meteoSwitch.enableReceive(0); //    2 checkWeather.setInterval(1800000, getClimate); //     delay(2000); //      } void txSwitch(long cmd) { //     RC-Switch,        meteoSwitch.disableReceive(); //  ,    for (byte txC=0; txC<1; txC++) { meteoSwitch.send(cmd, 24); meteoSwitch.enableReceive(0); } } void repeatAlarm() { //   ""      txSwitch(aL); water1=false; water2=false; water3=false; smoke1=false; smoke2=false; smoke3=false; } void enableRx() { meteoSwitch.enableReceive(0); //   } void loop () { checkWeather.run(); if (meteoSwitch.available()) { //      ,   int value = meteoSwitch.getReceivedValue(); if (value != 0) { switch (meteoSwitch.getReceivedValue()) { case 1418288: // Water leak KITCHEN -   ,    5  (   ) if (water1 == false) { aL=1418288; checkWeather.setTimeout(5000, repeatAlarm); water1 = true; } break; case 3470133: // Water leak WASHER if (water2 == false) { aL=3470133; checkWeather.setTimeout(5000, repeatAlarm); water2 = true; } break; case 3592421: // Water leak MAIN if (water3 == false) { aL=3592421; checkWeather.setTimeout(5000, repeatAlarm); water3 = true;} break; case 1084887: // Smoke KITCHEN if (smoke1 == false) { aL=1084887; checkWeather.setTimeout(5000, repeatAlarm); smoke1=true; } break; case 2184536: // Smoke HALL if (smoke2 == false) { aL=2184536; checkWeather.setTimeout(5000, repeatAlarm); smoke2 = true; } break; case 12602757: // Smoke ROOM if (smoke3 == false) { aL=12602757; checkWeather.setTimeout(5000, repeatAlarm); smoke3 = true;} break; case 15741424: //      txSwitch(15741424); break; case 46151: //      txSwitch(46151); break; case 46150: //      txSwitch(46150); break; //  - // tv-on case 88100: irsend.sendNEC(0x20DF10EF,32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; //     // tv-back case 88116: irsend.sendNEC(0x20DF14EB,32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; // tv-volup case 88132: irsend.sendNEC(0x20DF40BF,32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; // tv-voldown case 88164: irsend.sendNEC(0x20DFC03F,32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; // tv-chup case 88128: irsend.sendNEC(0x20DF00FF,32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; // tv-chdown case 88256: irsend.sendNEC(0x20DF807F,32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; // tv-mute case 88512: irsend.sendNEC(0x20DF906F,32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; // tv-menu case 89100: irsend.sendNEC(0x20DFC23D,32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; // tv-ok case 89108: irsend.sendNEC(0x20DF22DD,32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; // tv-up case 89116: irsend.sendNEC(0x20DF02FD,32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; // tv-down case 89132: irsend.sendNEC(0x20DF827D,32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; // tv-left case 89164: irsend.sendNEC(0x20DFE01F,32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; // tv-right case 89128: irsend.sendNEC(0x20DF609F,32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; // tv-av case 89256: irsend.sendNEC(0x20DFD02F,32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; // media-on case 89512: irsend.sendNEC(0xF9EA15,32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; // media-off case 87108: irsend.sendNEC(0xF9EA15,32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; // media-play case 87116: irsend.sendNEC(0xF90AF5,32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; // media-back case 87132: irsend.sendNEC(0xF9F20D,32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; // media-volup case 87164: irsend.sendNEC(0xF9E817,32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; // media-voldown case 87128: irsend.sendNEC(0xF92AD5,32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; // media-ff case 87256: irsend.sendNEC(0xF9C03F,32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; // media-rew case 87512: irsend.sendNEC(0xF9E01F,32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; // media-menu case 92108: irsend.sendNEC(0xF96897,32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; // media-set case 92116: irsend.sendNEC(0xF958A7,32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; // media-up case 92132: irsend.sendNEC(0xF9C23D,32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; // media-down case 92164: irsend.sendNEC(0xF950AF,32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; // media-left case 92128: irsend.sendNEC(0xF9609F,32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; // media-right case 92256: irsend.sendNEC(0xF9708F,32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; // media-ok case 92512: irsend.sendNEC(0xF940BF,32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; // ac-cool case 95108: IRTransmit(2, 59); delay(150); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; // ac-heat case 95116: IRTransmit(3, 59); delay(150); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; // ac-on case 95132: IRTransmit(0, 59); delay(150); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; // ac-off case 95164: IRTransmit(1, 59); delay(150); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); break; } } meteoSwitch.resetAvailable(); } } //   void getClimate() { int Pressure = bmp.readPressure()/100; int Temperature = bmp.readTemperature()*10; myData = 12100000+Pressure; meteoSwitch.send(myData, 24); //   if (Temperature > 0) { myData = 13100000+Temperature; meteoSwitch.send(myData, 24); //    } else { myData = 13101000+abs(Temperature); meteoSwitch.send(myData, 24); //    } } //   "" - void IRTransmit(byte cmd, byte cmdlen) { // prog_uint16_t *currentIRRemotePointer = (prog_uint16_t *)pgm_read_word(&IRRemotePointer[cmd]); //      PROGMEM unsigned int IRRawCodes[cmdlen]; //       for (byte i = 0; i < cmdlen; i = i + 1) { //    IRRawCodes[i] = pgm_read_word(¤tIRRemotePointer[i]); // } irsend.sendRaw(IRRawCodes, cmdlen, 38); //    IRRemote delay(150); } 






Well, the last. If you make a mistake somewhere - say, we will understand. And the rest, I believe that you know, can and can do better.



ps. and who complained about the boring abbreviations in the title?

Source: https://habr.com/ru/post/213425/



All Articles