Hey all!
I took a long hiatus from electronics and am having a bit of trouble finding a way to take data from one long array and breaking it into smaller arrays for an RFID reader code I want to write. It is supposed to compress alot of different separate codes into a single code so I can have a more versatile platform to use when working with RFID cards. Otherwise i will spend half my time uploading the codes over and over. So please just bare with the awful awful code below. Essentially I am sending a bunch of variables over a single message through serial and need to break it into parts. I can do it with the single digit variables but my issue is lying in how to send the actual messages. This is what I thought of but it could just be garbage:
Basically all I want to do is type in "initialize [int] [int] [16 character message]" the 1st int will tell it the specific command, the 2nd int being the block and the 16 character message being what is written on the block, I cannot seem to break off the 16 character message as it's own array from the original 28 one
(completely forgot how to insert code into a separate window so I shortened it)
int a = 0;
int i = 0;
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();
// say what you got:
Serial.print("I received: ");
Serial.println(incomingByte, DEC);
statement = incomingByte;
- i++;*
- int x = statement[11];*
- int y = statement [0];*
- int z = statement [1];*
- int zz = statement [2];*
- if (x != 0 && y == 105 && z == 110 && zz == y) {*
- Serial.print("I have decided: ");*
- Serial.println(x);*
//^^ this checks to see if the first three letters match the command I want (I know its not super accurate but whatever) - if (x == 49) {*
- Serial.print("Card Rewrite Selected for Block: ");*
- int block = statement[13];*
- Serial.println(block);*
//This section divines the desired block by looking at the number following the "Initialize" - for (i = 14; i < 29; i++) {*
- int a = i-14;*
_ byte blockcontent[a] = statement*;_
_ }_
_ Serial.print("Message Received To Be: ")_
_ Serial.println(blockcontent[]);_
_//This section is the problem as I cannot compile because it says the array must be initialize with a brace enclosed initializer*_