Reference   Language | Libraries | Comparison | Changes

Ciao

Ciao.splitString()

Description

The splitString function enables the user to manage the MCU command sent by the connector. The function accepts up four parameters, the first is the serial command for the MCU, the second parameter is the character that should be used to split the serial command, while the third and fourth parameter are respectively, the array of strings used to split the serial command received and the size of the array itself .

Syntax

data.get(string, divisor, array, size);

Returns

The data at the selected index

Example

#include<ciao.h>

void setup() {
  Ciao.begin();
  Serial.begin(57600);
  }

void loop() {
  CiaoData data = Ciao.read("xmpp");
  String id = data.get(0);
  String sender = data.get(1);
  String message = data.get(2);
  String command[3];
  splitString(message,"/",command,3);
  Serial.println("command type: "+command[0])
  //output is digital Serial.println("pin: "+command[1])
  //output is 13 Serial.println("pin value: "+command[2]))
  //output is 1
   }
Reference Home

Corrections, suggestions, and new documentation should be posted to the Forum.

The text of the Arduino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.

Share