This part of the robot structure provides IO tools to access serial communication (based on USerial module), read/write data to disk (based on UTextTool module) and access RFID reader (URfid module).

Serial communication functions

This part of robot.io structure utilize USerial module - it's a full copy of the module.

   // open port
   // portName - "COM1", "COM2", "COM3"...,
   // baudRate - 110, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 56000, 57600, 115200, 128000, 256000,
robot.io.serial.Open(portName, baudRate);
   // close port,
robot.io.serial.Close;
   // write string to port,
robot.io.serial.WriteStr(string);
   // write multibyte data to port,
robot.io.serial.WriteVec([byte0,byte1,...]);
   // get a number of received bytes,
robot.io.serial.BytesToRead();
   // read data vector from port, 
robot.io.serial.ReadVec();
   // read data vector from port
robot.io.serial.ReadStr();

Read/write to disk functions

This part of robot.io.disk structure utilize UTextTool module.

   // save text to file
   // text - string to save
   // fileName - path and file name
robot.io.disk.SaveToFile(text, fileName);
   // open file,
   // fileName - path and file name
robot.io.disk.ReadFromFile(fileName);

RFID reader functions

This part of robot.io.rfid structure utilize URfid module - it's a full copy of the module. See the module documentation for more details about rfid technology, used hardware and tags.

   // check if card exist, this function always fills cardSerial variable
   // returns:
   // 0 - no card,
   // 1 - is card,
   // 2 - is more than one card,
robot.io.rfid.IsCard();
   // card serial number, [sn0,...,sn3], read if IsCard() returns true
robot.io.rfid.cardSerial;
   // set request mode
   // 0 - idle
   // 1 - all
robot.io.rfid.requestMode;
   // set access key type
   // 0 - KeyA,
   // 1 - KeyB,
robot.io.rfid.keyType;
   // set access key, key must be 6-size array.
robot.io.rfid.SetBlockKey([key0,…,key5]);
 
   // read data from card
   // startBlock - 0..(cardMemorySize/16)
   // numberBlocks - 1..4
robot.io.rfid.ReadCard(startBlock, numberBlocks);
   // read data in array form [data0, data1,..,data15],
robot.io.rfid.cardData;
   // read data in string form, "text”
robot.io.rfid.cardString;
 
   // ! BE CAREFUL to not write Sector Trailer if not intend, recommend to write data block by block - size not longer than 16!
 
   // write data to card, returns true if success,
   // startBlock - 1..(cardMemorySize/16), 0 can NOT be written,
   // data - size must be 1..64,
robot.io.rfid.WriteCardData(startBlock, [data0, data1,..,data15]);
   // write text to card, returns true if success,
   // startBlock - 1..(cardMemorySize/16), 0 can NOT be written,
   // text - size must be 1..64.
robot.io.rfid.WriteCardString(startBlock, "0123456789ABCDEF");
   // turn on buzzer,
   // turn on/off LED blinking.
robot.io.rfid.Buzzer(freq, duration);
robot.io.rfid.LED(freq, duration); 
 
 

 

 

EMYS and FLASH are Open Source and distributed according to the GPL v2.0 © Rev. 1.0, 04.04.2018

FLASH Documentation