I have a working version of a RPi with 433 Mhz transmitter and the RCSwitch library that I’m using for some simple home automation tricks. I’d like to port it to the Photon to save on space, power, etc. However, I’m having trouble getting it working. Here’s my setup:
The Photon is being powered over USB by a computer, as well. And the firmware code is here:
#include "RCSwitch/RCSwitch.h"
#define OFFICE_Light_1_Toggle 87489
RCSwitch switchObj = RCSwitch();
void smartHomeHandler(const char *event, const char *data)
{
Serial.print(event);
Serial.print(", data: ");
if (data)
Serial.println(data);
else
Serial.println("NULL");
}
void setup() {
pinMode(D3, OUTPUT);
Serial.begin(9600);
switchObj.enableTransmit(D3);
Particle.subscribe("smart-home", smartHomeHandler);
}
void loop() {
switchObj.send(OFFICE_Light_1_Toggle, 24);
delay(2000);
}
When I upload the firmware, I get no response from the light that uses the above code number - it should be blinking on/off every two seconds. However, I can still use the RPi setup as well as sending the code manually to toggle the light. I’ve checked the RF transmitter works, and it has no issues. I also tried on different D# GPIO ports on the Photon to no avail. Any ideas about what I’m doing wrong? Thanks for anyone’s help!
Steve