Hi Majenko
I wrote a state machine code that worked, I think, but I had trouble getting my head around the time code at the base, what I have so far is;
/*
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
void setup() {
// initialize serial communication:
Serial.begin(9600);
mySwitch.enableReceive(0); // Receiver on inerrupt 0 => that is pin #2
// initialize the pins:
for (int Pins = 2; Pins 4; thisPin++) {
pinMode(Pins, OUTPUT);
}
}
void loop() {
if (mySwitch.available()) {
unsigned long value = mySwitch.getReceivedValue();
switch (getReceivedValue()) {
case 7419184:
digitalWrite(Pins, HIGH);
Serial.print("Mosfet ON - Value: "); // This and the next three lines are for debug and testing purposes
Serial.print(mySwitch.getReceivedValue() );
Serial.println("");
break;
case 7419139:
digitalWrite(Pins, LOW);
Serial.print("Mosfet OFF - Value: "); // This and the next two lines are for debug and testing purposes
Serial.print(mySwitch.getReceivedValue() );
Serial.println("");
break;
default:
Serial.print("Received Other Value: "); // This and the next two lines are for debug and testing purposes
Serial.print(mySwitch.getReceivedValue() );
Serial.println("");
}
}
}
}
I think it was getting late so I filed it in the THB (too hard basket) for now, I think the #Define states at the top were confusing me so i was trying to work around them(without them), but then when I got to the time code at the base I totally lost track of what did what as I wasn't using the states, each state needs to apply to two pins, so i wasnt sure how to do that either. , i forget if it worked at all now, once I have the parts back I will do some more testing.
And the parts I need for testing are with a friend who is making a mockup of a custom shield to mount the three modules I'm using (RX, VReg, Mosfet)