Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <ipst.h>
- int x,xxxx,yyyy,zzzz,zzzz2,zzzz3;
- #define RELAY1 19
- #define RELAY2 20
- #define RELAY3 21
- #define RELAY4 22
- byte relays[4] = {RELAY1,RELAY2,RELAY3,RELAY4};
- void setup()
- {
- //OK();// Wait for OK button
- glcdClear();
- glcdMode(2);
- setTextSize(23);
- setTextColor(GLCD_GREEN);
- }
- void loop()
- {
- glcd(0,0,"%d",knob(1,5));
- if(sw_OK())
- {
- if(knob(1,5)==1)
- {
- for(x=0;x<20;x++){
- for(int xxxx=0;xxxx<4;xxxx++){ out(relays[xxxx],0); }
- out(relays[random(0, 4)],1);
- delay(random(75,100));
- }
- }
- else if(knob(1,5)==2)
- {
- while(1){
- for(x=0;x<10;x++){
- for(int xxxx=0;xxxx<4;xxxx++){ out(relays[xxxx],0); }
- yyyy=relays[random(0, 4)];
- zzzz=relays[random(0, 4)];
- out(yyyy,1);
- out(zzzz,1);
- delay(random(75,100));
- }
- if(yyyy==zzzz)
- {
- x=0;
- }
- else{break;}
- }
- }
- else if(knob(1,5)==3)
- {
- while(1){
- for(x=0;x<5;x++){
- for(int xxxx=0;xxxx<4;xxxx++){ out(relays[xxxx],0); }
- yyyy=relays[random(0, 4)];
- zzzz=relays[random(0, 4)];
- zzzz2=relays[random(0, 4)];
- out(yyyy,1);
- out(zzzz,1);
- out(zzzz2,1);
- delay(random(75,100));
- }
- if(yyyy==zzzz || yyyy==zzzz2 || zzzz==zzzz2)
- {
- x=0;
- }
- else{break;}
- }
- }
- else if(knob(1,5)==4)
- {
- for(int xxxx=0;xxxx<4;xxxx++){ out(relays[xxxx],0); }
- for(int xxxx=0;xxxx<4;xxxx++){out(relays[xxxx],1);}
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement