USB_COM
#include <io>
#include <read>
#include <float>
#include <string>
#include <core>
#include <write>
#include <define>
new rs[10];
new len;
main(){
Init(USB); // Initialize USB COM
while(1){
len = buf_len(USB); // Read USB buffer length
if(len != 0){ // If length not equal 0 then read USB buffer
read_buf(USB, 4, rs); // Read USB buffer into rs array (read 4 bytes length array)
if(strcmp(rs, "test", false, 4) == 0){ // Compare rs buffer with "test" text (Compare 4 bytes)
write_buf(USB, 10 ,"USB OK 4 !"); // Send data "OK 4 !" over USB COM (length 10 bytes)
}
}
Delay(1000); // Delay 1 sec.
}
}