Hello I’m trying to do a delay to generate code of an IR control in a function with imp.sleep() but I need that the delay are the most exactly possible and when I use imp.sleep(.009) for example, the real result is 1.5 ms or imp.sleep(.000560) the result is .000984 seg, and the control doesn´t work. So my question is if exist some way to improve the precision or if exist another way to do a delay with more exactly this problem
As squirrel is an interpreted language, this isn’t going to work; you can’t hold timings that tight. I’d suggest you build your waveform as a bitstream, and use SPI to clock it out of a MOSI pin at a suitable rate; you can then hold much better timings.
Either that, or use the fixedfrequencydac to do a similar job.