Dank zij de zeer goede uitleg van Emiel Mols in dit
topic ben ik er ook in geslaagd een TX433 te laten communiceren met de Arduino Decimilia. Aan de Arduino kunnen ook sensoren gekoppeld worden om het klik-uit-klik-aan te beschakelen. Deze kan eveneens communiceren via de usb (serieel ) met Windows, Linux of Mac of via de interne sketch zie onder
Below is the software sketch
/* Klik-Uit-Klik-Aan Arduino Interface
* Adapted from
[EiP] room control
*
* modified by jan rietbergen
* v. 0.1 - very basic functions - loop through the channels
*
*/
int portTx = 13;
int delayL = 426; //3*426=1278 =1.28msec
void setup ()
{
Serial.begin(9600);
}
//loops all channels
void loop() {
for (int x=0; x <=255; x++){
Serial.println(x);
outputKakuRFSignal(x, 0);
delay(1000);
outputKakuRFSignal(x, 1);
delay(1000);
}
}
void outputKakuRFSignal(unsigned char channel, unsigned char command) {
unsigned char count = 0;
// power up transmitter not implemented
while (count < 3) {
outputKakuRFSignalSeq(channel, command);
delay(4);
count++;
}
// power down transmitter
}
void outputKakuBit(unsigned char theBit) {
digitalWrite(portTx, HIGH);
delayMicroseconds(delayL);
digitalWrite(portTx, (theBit > 0) ? HIGH : LOW);
delayMicroseconds(delayL);
digitalWrite(portTx, LOW);
delayMicroseconds(delayL);
}
void outputKakuRFSignalSeq(unsigned char channel, unsigned char command) {
//letters
outputKakuBit(0);
outputKakuBit((channel & B00010000) >> 4);
outputKakuBit(0);
outputKakuBit((channel & B00100000) >> 5);
outputKakuBit(0);
outputKakuBit((channel & B01000000) >> 6);
outputKakuBit(0);
outputKakuBit((channel & B10000000) >> 7);
//numbers
outputKakuBit(0);
outputKakuBit((channel & B00000001));
outputKakuBit(0);
outputKakuBit((channel & B00000010) >> 1);
outputKakuBit(0);
outputKakuBit((channel & B00000100) >> 2);
outputKakuBit(0);
outputKakuBit((channel &B00001000) >> 3);
//unknown
outputKakuBit(0);
outputKakuBit(0);
outputKakuBit(0);
outputKakuBit(1);
outputKakuBit(0);
outputKakuBit(1);
outputKakuBit(0);
outputKakuBit(command);
outputKakuBit(0);
}