eggzlot Posted January 18, 2015 Share Posted January 18, 2015 Currently I use a .wav file for the doorbell sounds which play through a C4 Amp to a few rooms in my house. If I had 2-3 audio wav files and I wanted it to randomly pick 1 of the 2 or 3, how would I do that in programming. Basically looking for an "or" statement or something if you will Link to comment Share on other sites More sharing options...
brucecampbell Posted January 18, 2015 Share Posted January 18, 2015 There is no explicit OR statement but you can achieve the same result using the IF statement and variables variable = variable + 1IF variable = 1 use audio1.wavIF variable = 2 use audio2.wavIF variable = 3 use audio3.wav variable = 0 Not sure about random, as never seen any random functionality, but I'm sure you could write a small piece of code based on a timer to randomly set a variable value. Link to comment Share on other sites More sharing options...
alanchow Posted January 19, 2015 Share Posted January 19, 2015 When Doorbell Press->Set to Random Value Between (min 1 max 3) When Variable changes->if variable equal to 1->->Execute Announcement 1->if variable equal to 2->->Execute Announcement 2->if variable equal to 3->->Execute Announcement 3 Link to comment Share on other sites More sharing options...
eggzlot Posted January 20, 2015 Author Share Posted January 20, 2015 thanks Alanbusy weekend but I am going to attempt this in the next few days and will reply back with my results Link to comment Share on other sites More sharing options...
eggzlot Posted January 28, 2015 Author Share Posted January 28, 2015 Hi AlanSeems to have worked - thanks! It is about 10 degrees outside and 8'' of snow so not standing out there testing it too much but I pressed it a few times, hit execute a few times, and I think I am good to go. Thanks again! Link to comment Share on other sites More sharing options...
alanchow Posted January 28, 2015 Share Posted January 28, 2015 Hi AlanSeems to have worked - thanks! It is about 10 degrees outside and 8'' of snow so not standing out there testing it too much but I pressed it a few times, hit execute a few times, and I think I am good to go. Thanks again! No problems. Pretty simple to do. I used to do random 'the ring' video on my TV (with flickering lights) upon motion sensing (1/100 chance). Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.