- Tue Feb 13, 2018 9:08 pm
#73958
I stopped being sensitive a long time ago ... Turns out I hadn't researched enough. This relay board uses a STC15F104 or a STC16F104 chip as the control voltage to the base of the relay driver transistor. And to talk to the STC chip you send a set of 4 hex chars via TX. Why Serial.write instead of GPIO0/2 - because
Reading up on the STC chip I have to think that there are more codes that are avail (wag) relSTAT, relXYZ??? But then again.
Code: Select all//Hex command to send to serial for close relay
byte relON[] = {0xA0, 0x01, 0x01, 0xA2};
//Hex command to send to serial for open relay
byte relOFF[] = {0xA0, 0x01, 0x00, 0xA1};
...
Serial.begin (9600);
... web/curl/php http://boardIP/on or /off
if (req.indexOf ("/on") != -1)
{
Serial.write (relON, sizeof(relON));
} else {
if (req.indexOf ("/off") != -1)
Serial.write (relOFF, sizeof(relOFF));
}