Pages: [1]   Go Down
Author Topic: Getting string from serial  (Read 296 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,
I want to read an uart sensor that returns a string (RFID tag id). I want to use a software serial port to read the sensor. My question is how do I read whole strings from serial?
Logged

The Netherlands
Offline Offline
Edison Member
*
Karma: 50
Posts: 1708
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You don't.

You read serial data, and put that in an array.
Nick Gammon (the master Yoda of the Arduino universe) has a few examples (click) you can try.
Logged

Have a look at "blink without delay".
Did you connect the grounds ?
Je kunt hier ook in het Nederlands terecht: http://arduino.cc/forum/index.php/board,77.0.html

UK
Offline Offline
Faraday Member
**
Karma: 100
Posts: 4153
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

And I wouldn't be me if I didn't (yet again) point out my little tutorial and example code: http://hacking.majenko.co.uk/reading-serial-on-the-arduino
Logged

Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

The Netherlands
Offline Offline
Edison Member
*
Karma: 50
Posts: 1708
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi majenko.
I wasn't aware of that one yet, i'll check it out tomorrow.
Logged

Have a look at "blink without delay".
Did you connect the grounds ?
Je kunt hier ook in het Nederlands terecht: http://arduino.cc/forum/index.php/board,77.0.html

0
Offline Offline
Tesla Member
***
Karma: 145
Posts: 9682
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
My question is how do I read whole strings from serial?

Serial bytes are usually read one at a time from the serial source and formed into a c-string or String for use.
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 497
Posts: 19055
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I have an RFID reader sketch here:

http://www.gammon.com.au/forum/?id=11283
Logged


Pages: [1]   Go Up
Jump to: