Hi,
Doing this without VirtualWire.
I have some el-cheapo sensors e.g. hall-effect door-open sensor, that send out a short coded message using 433.92MHz ASK module. So I rigged up my Arduino with a RXD1 (433MHz receiver unit) connecting it to the Arduino, just as explained in the VirtualWire documentation. However I am not using the VirtualWire library, because my transmitting device doesn't follow the VirtualWire protocol. So I wrote a very small program to read what the module is throwing at the Arduino input pin. What amazes me is that there is a continuous / steady stream of 0's, 1's, in no particular pattern, which seems more like noise. On removing the connection between data-out from the RXD1 and Arduino, the random flipping stops, and restarts as soon as I plug the wire in. Looking for advise on how to improve the code, and how to actually start detecting the code sent out by my sensor to my Arduino.
int lastVal = 0;
int lastBitCount = 0;
void setup() {
Serial.begin(9600);
pinMode(11, INPUT);
}
void loop() {
int sensorValue = digitalRead(11);
if (lastVal != sensorValue) {
Serial.print("Lc: ");
Serial.print(lastBitCount, DEC);
Serial.print(" Bit: ");
Serial.println(lastVal, DEC);
lastBitCount = 0;
lastVal = sensorValue;
}
else {
lastBitCount ++;
}
delay(10);
}
And here's a small excerpt of what it spews out in Serial-port monitor...
Lc: 1 Bit: 0
Lc: 0 Bit: 1
Lc: 2 Bit: 0
Lc: 4 Bit: 1
Lc: 0 Bit: 0
Lc: 1 Bit: 1
Lc: 10 Bit: 0
Lc: 6 Bit: 1
Lc: 1 Bit: 0
Lc: 0 Bit: 1
Lc: 0 Bit: 0
Lc: 2 Bit: 1
Lc: 4 Bit: 0
Lc: 0 Bit: 1
Lc: 10 Bit: 0
Lc: 2 Bit: 1
Thanks for pointers, guidance.
regards,
F