Alright, so after much work, I've written this code; and it doesn't even work.
#include <Manchester.h>
#define RX_PIN 9
unsigned long bits_in = man.getMessage();
void setup()
{
man.setupReceive(RX_PIN, MAN_4800);
man.beginReceive();
}
void loop() {
if (man.receiveComplete()) {
if (1 == (bitRead(bits_in, 0))); {
(0 == (bitRead(bits_in, 1)));{
(0 == (bitRead(bits_in, 2)));{
(1 == (bitRead(bits_in, 3)));{
(1 == (bitRead(bits_in, 4)));{
(1 == (bitRead(bits_in, 5)));{
(0 == (bitRead(bits_in, 6)));{
(1 == (bitRead(bits_in, 7)));{
(1 == (bitRead(bits_in, 24)));{
(1 == (bitRead(bits_in, 25)));{
(1 == (bitRead(bits_in, 26)));{
(1 == (bitRead(bits_in, 27)));{
(1 == (bitRead(bits_in, 28)));{
(1 == (bitRead(bits_in, 29)));{
(0 == (bitRead(bits_in, 30)));{
(1 == (bitRead(bits_in, 31)));{
{
man.beginReceive(); //start listening for next message right after you retrieve the message
if (1 == (bitRead(bits_in, 8)));{
digitalWrite(2, HIGH);
if (1 == (bitRead(bits_in, 9)));{
digitalWrite(4, HIGH);
if (1 == (bitRead(bits_in, 10)));{
digitalWrite(8, HIGH);
if (1 == (bitRead(bits_in, 11)));{
digitalWrite(12, HIGH);
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
On the transmitting side, I've got this code:
#include <Manchester.h>
#define TX_PIN 9
void setup() {
// put your setup code here, to run once:
man.setupTransmit(TX_PIN, MAN_4800);
}
void loop() {
// put your main code here, to run repeatedly:
man.transmit (1001110111111111111111111111111111111101);
}
The receiver does not work properly and turns everything on even if the data feed is not connected. Keep in mind, I'm connecting the two arduinos directly together. If I deleted all the code and set the receiver to do nothing but serially print the received data, I get zeros no matter what. Anybody have any suggestions?