1

My Input from Cool terminal is 05 03 00 01 00 02 94 4F

I should be able to read this input 05 03 00 01 00 02 94 4F compare with the same(05 03 00 01 00 02 94 4F). If the incoming value(05 03 00 01 00 02 94 4F) and the predefined value(05 03 00 01 00 02 94 4F) are the same it should print the hex value like

05 03 04 43 65 BA 7D 04 E8

I tried to code it but i could'nt get the value. Here is my code in Arduino

    void setup()
    {
      Serial.begin(9600);
    }

    void loop()
    {
      static char buffer[1024];
      static size_t length = 0;

      if (Serial.available()) {
        char c = Serial.read();

        // Otherwise buffer the incoming byte.
        //else if (length < sizeof buffer - 1) {

        Serial.write(c);  // echo
        buffer[length++] = c;
      }
    }
7
  • 1
    You didn't include your code. And what does "couldn't get the value" mean?
    – chrisl
    Dec 6 '19 at 7:25
  • Did you read what you copy & pasted? (edit question, select code, press ctrl-k to align). What means 'read this input compare with the same' ? And where is the predefined value in the code (or is the predefined value something else? If so, what exactly? Dec 6 '19 at 10:36
  • I have edited it would be good for you to understand now. Dec 6 '19 at 11:09
  • how are you determining the value to print? .... ar you doing some calculation?
    – jsotola
    Dec 6 '19 at 16:23
  • @jsotola I am not doing any calculation. I just wanted to print the answer Dec 9 '19 at 8:47

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.