Hi everyone! I have a simple question-can i randomize values in this structure:
byte sending[][2] = {
{B11111111, B11000111},
{B11011111, B11110111},
{B11111011, B10000001},
{B11111011, B11010111},
{B10001111, B11000001},
{B11011011, B11110111},
{B10000000, B00011001},
{B11000001, B11111111},
};
I mean that i want to send random bytes to other arduino,and i dont understand how to use random in this situation
system
2
Use a random number as an array index.
AWOL:
Use a random number as an array index.
I used,but nothing changes.
I want to randomize binary values in array
system
4
Use a random number as the index into the array of binary values.
I'm not sure how many different ways this can be stated.
system
6
I used,but nothing changes.
You failed to post the code that does that.
byte sending[8][2] = {
{B11111111, B11000111},
{B11011111, B11110111},
{B11111011, B10000001},
{B11111011, B11010111},
{B10001111, B11000001},
{B11011011, B11110111},
{B10000000, B00011001},
{B11000001, B11111111},
};
unsigned long onceEverySecond;
void setup() {
Serial.begin(9600);
}
void loop() {
if (millis() - onceEverySecond >= 1000UL) {
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 2; j++) {
sending[i][j] = random() & 0x000000FF;
Serial.print(sending[i][j]);
}
}
onceEverySecond = millis();
}
}
system
8
for (int i = 0; i <= 8; i++)
Oops.
system
10
I'm still not sure that's what the OP asked for.
AWOL:
I'm still not sure that's what the OP asked for.
Agreed, but I hope he can take from it what he is asking for.