Serial.readbytesuntil()

Discussion in 'Embedded Systems and Microcontrollers' started by bhuvanesh, Jan 2, 2014.

Thread Status:
Not open for further replies.
  1. bhuvanesh

    Thread Starter Member

    Aug 10, 2013
    268
    2
    Code ( (Unknown Language)):
    1. void setup()
    2. {
    3.   Serial.begin(9600);
    4. }
    5. void loop()
    6. {char a[10];
    7.  
    8.   if(Serial.available())
    9.   {
    10.     byte b=Serial.readBytesUntil(b,a,10  );
    11.     Serial.println(b);
    12.   }
    13. }
    this is an arduino code

    here terminator string is b
    input:adb
    actuall output:3

    but expected out put is 2.how could it include terminator character as it made to terminate..help me
     
  2. Georacer

    Moderator

    Nov 25, 2009
    5,142
    1,266
    Breaking a problem to very small pieces doesn't really help. Resume the discussion over your whole project in this thread so that people can have a complete idea of what you are trying to do.

    Do not create any more new threads on this project.
     
    bhuvanesh likes this.
Thread Status:
Not open for further replies.