#include <LiquidCrystal_I2C.h>
int array[11] = {30,31,32,33,34,35,36,37,38,39, 40} ;
int array[15] = {1000, 1500, 2000, 2500, 3000, 3500, 4000, 4500, 5000, 5500, 6000, 6500, 7000, 7500, 8000. 8500, 9000, 9500, 10000} ;
int buttonPin = 4;
int buzzer = 25
long ran;
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup()
{
pinMode(buttonPin, INPUT_PULLUP); // define o pino do BotaoPin como entrada "INPUT"
pinMode(buzzer, OUTPUT);
Serial.begin(115200);
// next 3 lines are for randomizing the randomgenerator.
Serial.println("press a key");
while (Serial.available() ==0);
randomSeed(micros() + Serial.read());
// this is the trick
for (int i= 0; i< 11; i++)
{
int pos = random(12);
int t = array[i];
array[i] = array[pos];
array[pos] = t;
}
for (int i= 0; i< 11; i++)
{
Serial.print(i);
Serial.print(": ");
Serial.println(array[i]);
}
}
void loop()
{
while (digitalRead(buttonPin) == HIGH);
digitalWrite(buzzer, HIGH);
delay(random(200, 3001));
digitalWrite(buzzer, LOW);
}