2 Replies Latest reply on Mar 27, 2016 3:26 PM by RiKn_1565556

    CY8CKIT-043 scanf capability with UART?


      Hello All,


      I am a CY8CKIT-043 user trying to work my way through my first application.


      A couple weeks ago I posed some questions using the kit's UART function and within a day or so I was back on track, so I am hopeful that my current quandry is something that is easily fixed (i.e. some kind person will point me at an obvious solution I've overlooked.)


      Here is my situation: Using the PSOC Creator 3.3 application I have modified the kit's "breathing led" application to make use of the UART function to send strings from the kit to a Putty application.  That is working okay now making use of sprintf to fill buffers and then "printing" them using the UART_1_UartPutString() function included in the creator application.


      Now I am trying to go in the opposite direction.  I'd like to be able to do a 'scanf' response and capture either an integer, float or string value from the UART.  I've experimented with scanf which seems to be implemented in the creator but I can't make it work.  Essentially I'd like to be able to echo a string back to the user in putty and have them respond, for example "how many iterations?" to which the user responds with an integer.


      I realize I could do the getchar() route, capture every byte, convert the ascii to an integer, etc. etc. but I guess I'm just lazy.  I'd prefer to not to have to go to this level of effort unless I really have to.


      As I've already said, I could very well be missing something.  I've searched the net and browsed forums and looked at the reference manuals I've found and I come up empty.  Has anyone solved this problem before?