Coder Social home page Coder Social logo

New NEC format about irremoteesp8266 HOT 1 CLOSED

crankyoldgit avatar crankyoldgit commented on August 20, 2024
New NEC format

from irremoteesp8266.

Comments (1)

markszabo avatar markszabo commented on August 20, 2024

Well, right now it can not send it in HEX format, since (as you said) it uses a non-standard NEC protocol. But since you have the device, you may try to write the function for it, let's say sendNEC2.
Here is the sendNEC with comments:
void IRsend::sendNEC(unsigned long data, int nbits)
{
enableIROut(38); //it will use 38 kHz to module the signal. You can probably leave it
mark(NEC_HDR_MARK); //this sends a 'mark' in the length of NEC_HDR_MARK. Mark means turning on and off the IR led on 38 kHz
space(NEC_HDR_SPACE); //this sends a 'space' in the length of NEC_HDR_SPACE. Space means keeping the led turned off for that time.
for (int i = 0; i < nbits; i++) { //sending the signal
if (data & TOPBIT) {
mark(NEC_BIT_MARK);
space(NEC_ONE_SPACE);
}
else {
mark(NEC_BIT_MARK);
space(NEC_ZERO_SPACE);
}
data <<= 1;
}
mark(NEC_BIT_MARK);
space(0); //making sure the led is turned off in the end
}

As you can see the important part is the for loop with the algorithm and the timing constants: NEC_HDR_MARK, NEC_HDR_SPACE, NEC_BIT_MARK, NEC_ONE_SPACE, NEC_BIT_MARK, NEC_ZERO_SPACE. You can find these constants in IRremoteInt.h.

If I were you I would start figuring out the differences between your code and the standard NEC code, because if it is only about the length of the signal, then it's probably enough to change the for loop above. If you manage to make it work, don't forget to issue a pull request, so I can integrate it into the library :)

from irremoteesp8266.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.