Hey !
I justed started out programming with the arduino , its a great product.
I wanted to make a led go on by using a arduino(as transmittor) , and a attiny45 as reciever.
Im using 434mhz modules. I tested writing code to the attiny 45 before so i know it works.
But i cant get this code to work , im using the manchester library.
Attiny
#include <MANCHESTER.h>
#define TxPin 4 //the digital pin to use to transmit data
unsigned int Tdata = 101;
unsigned int TTdata = 102; //the 16 bits to send
void setup()
{
MANCHESTER.SetTxPin(TxPin); // sets the digital pin as output default 4
}//end of setup
void loop()
{
MANCHESTER.Transmit(Tdata);
delay(1000);
MANCHESTER.Transmit(TTdata);
delay(1000);
}//end of loop
Arduino
#include <MANCHESTER.h>
int Relay(0);
int val(0);
void setup()
{
// Set digital TX pin
MANRX_SetRxPin(4);
// Prepare interrupts
MANRX_SetupReceive();
// Begin receiving data
MANRX_BeginReceive();
pinMode(Relay, OUTPUT);
Serial.begin(9600);
}
void loop()
{
if (MANRX_ReceiveComplete())
{
unsigned int data = MANRX_GetMessage();
MANRX_BeginReceive();
Serial.println(data);
}
if (Serial.read() == '101'){
digitalWrite(Relay, HIGH);
}
if (Serial.read() == '102'){
digitalWrite(Relay, LOW);
}
}