Help with Metro


hi there -
i'm having bit of difficulty getting metro library want to.  any suggestions appreciated.
here i'm trying do:

pulse 3 solenoids each fraction of second create rhythm.
metro let me control amount of time solenoid either on or off during second.  but have each solenoid off first fraction of second, pulse on, , stay off remainder of second.  that way can stagger beats.

any suggestions help.  thanks.
below code

/*

*/
#include <metro.h> //include metro library
#define sol1 1
#define sol2 2
#define sol3 3


int state1 = high;
int state2 = high;
int state3 = high;



metro sol1metro = metro(1000);
metro sol2metro = metro(1000);
metro sol3metro = metro(1000);

void setup()
{
 pinmode(sol1,output);
 pinmode(sol2,output);
 pinmode(sol3,output);
 
 digitalwrite(sol1,state1);
 digitalwrite(sol2,state2);
 digitalwrite(sol3,state3);
 
}

void loop()
{

 if (sol1metro.check() == 1) {
   if (state1==high)  {
     state1=low;
     sol1metro.interval(500);
   }
   else {
     sol1metro.interval(500);
     state1=high;
   }
   digitalwrite(sol1,state1);
 }



 if (sol2metro.check() == 1) {
   if (state2==high)  {
     state2=low;
     sol2metro.interval(700);
   }
   else {
     sol2metro.interval(300);
     state2=high;
   }
   digitalwrite(sol2,state2);
 }


 if (sol3metro.check() == 1) {
   if (state3==high)  {
     state3=low;
     sol3metro.interval(900);
   }
   else {
     sol3metro.interval(100);
     state3=high;
   }
   digitalwrite(sol3,state3);
   
 }

 

}

sfduino:

just switch states (high instead of low , low instead of high).

regards.

gabo


Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Help with Metro


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums