samedi 12 décembre 2020

Arduino pick a random word from given array

I have this code that prints a word on an LCD:

void setup(){
lcd.print("Hello World");
}

I want it to pick a random word from this array:

const char *words[] = {"Happy","Sad","Angry","Worried","Shy","Excited","Suprised","Silly","Jealous","Hurt","Cold","Hot","Energized","Bored","Sick","Love","Upset"};

So basically using this array I want it to pick a random word from this array and then to display it on the LCD using the lcd.print method. Any ideas? Sorry if the answer is very obvious, I am only beginner at Arduino.




Aucun commentaire:

Enregistrer un commentaire