I'd like to make a remote control with an atmega328 and a 433MHz transmitter, which will be recieved by another atmega328 and a 433MHz Reciever.
I understand how I can send high or low signals with it, but how can I get it to understand different signals? Or transmit something like the value of a potmeter?
potValue = analogRead (A0);
msg[1]=highByte (potValue); // split the readug into 2 bytes
msg[2] = lowBYte (potValue);
vw_send((uint8_t *)msg, strlen(msg)); // send the msg[array] out
vw_wait_tx(); // Wait until the whole message is gone
After receiving, put the 2 bytes back together into an int:
potValueRx = (upperbyteRx<<8) + lowerbyteRx;
I only need like 16 buttons or so, implementing a whole library seems a bit overkill..
I was thinking about sending PWM signals through the transmitter, and having the reciever calculating an average, which will indicate which button it is.
Well, using in that case. I'd just like to stick with my own code.
I was thinking about sending PWM signals through the transmitter, and having the reciever calculating an average, which will indicate which button it is.
Inevitableavoidance:
I only need like 16 buttons or so, implementing a whole library seems a bit overkill..
I was thinking about sending PWM signals through the transmitter, and having the reciever calculating an average, which will indicate which button it is.
Does that sound possible?
pulse widths will be affected by the modulation and demodulation used in the RF link - expect some distortion. You could use a frequency proportional to your signal (so long as it doesn't exceed the limit of the TX RX pair.
The advantage of using serial is that you can packetize your transmission and save on TX power when not sending data. You will need at the very least a packet-start sequence and a checksum byte or two.