Reference for Wiring version 1.0 Build 0100+ If you have a previous version, use the reference included with your software. If see any errors or have any comments, let us know.
Class | Messenger |
---|---|
Name | available() |
Examples | #include <Messenger.h> // Instantiate Messenger object with the message function //and the default separator (the space character) Messenger message = Messenger(); // Define messenger function void messageCompleted() { // This loop will echo each element of the message separately while ( message.available() ) { if ( message.checkString("on") ) { digitalWrite(48,HIGH); } else if ( message.checkString("off") ) { digitalWrite(48,LOW); } } } void setup() { // Initiate Serial Communication Serial.begin(115200); message.attach(messageCompleted); pinMode(48,OUTPUT); } void loop() { // The following line is the most effective way of // feeding the serial data to Messenger while ( Serial.available() ) message.process( Serial.read() ); } |
Description | Check if there are any element available in the message. You must call process() before calling available(). |
Syntax | available()
|
Returns | Boolean: True if there are any elements available in the message. |
Usage | Application |