0

I am using a receiver module with arduino. I want to use my own transfer protocol and now I need to accept it. I tried to use various libraries but all without success. I need to somehow select a sequence of pulses and then determine their values ​​(zero or one) from the duration of the pulses. But first I need to determine the beginning of the signal from the preamble (12 pulses at the beginning). I wrote a program that draws a graph where you can see the whole sequence. Is it possible to define this preamble without using libraries, for example, make a loop that will measure the length of the pulses, and there 12 times the duration of the pulses will be the same, then this is the preamble followed by digital data.

#define IN_PIN 2
void setup() 
{
  Serial.begin(115200);
}

void loop() 
{
  bool s = digitalRead(IN_PIN);
  Serial.println(s);
}

enter image description here

1
  • 1
    Look up the pulseIn() function...
    – Majenko
    Jun 21 at 13:34

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.