The error message I get is that can not compilte to the ATtiny25/45/85.
Using two separate LoRa transreceivers, the program is intended to blink a LED upon receiving a message from the second LoRa transreceiver that broadcasts the correct syncword. I was able to get the below code (modified to remove the serial print messages) using two Adriuno UNOs and two separate LoRa tranreceivers.
Currently I have the ATtiny45 wired with the LED going to ATtiny45 PB3, the IRQ to PB4, SCK to PB2, MISO to PB1, and CS PB0. I was able to test the wiring and ATtiny45 using the basic blink program as described in the YouTube video to shrink your Adruino project.
/*
LoRa Duplex communication
Sends a message every half second, and polls continually
for new incoming messages. Implements a one-byte addressing scheme,
with 0xFF as the broadcast address.
Uses readString() from Stream class to read payload. The Stream class'
timeout may affect other functuons, like the radio's callback. For an
created 28 April 2017
by Tom Igoe
*/
#include <SPI.h> // include libraries
#include <LoRa.h>
const int receiveLED = 3;
const int csPin = 0; // LoRa radio chip select
const int resetPin = 5; // LoRa radio reset
const int irqPin = 4; // change for your board; must be a hardware interrupt pin
byte localAddress = 0xFF; // address of this device
byte destination = 0xBB; // destination to send to
byte syncWord = 0xB4; // sync word (network ID)
byte spreadingFactor = 8; // spreading factor (6-12)
void setup() {
LoRa.setPins(csPin, resetPin, irqPin); //set CS, reset, IRQ pin
LoRa.begin(900E6); // initialize ratio at 900 MHz
LoRa.setSyncWord(syncWord);
LoRa.setTimeout(10);
LoRa.setSpreadingFactor(spreadingFactor);
// set the I/O pin modes;
pinMode(receiveLED, OUTPUT);
}
void sendMessage(String outgoing) {
LoRa.beginPacket(); // start packet
LoRa.write(destination); // add destination address
LoRa.write(localAddress); // add sender address
LoRa.write(outgoing.length()); // add payload length
LoRa.print(outgoing); // add payload
LoRa.endPacket(); // finish packet and send it
}
void onReceive(int packetSize) {
if (packetSize == 0) return; // if there's no packet, return
digitalWrite(receiveLED, HIGH); // turn on the receive LED
// read packet header bytes:
int recipient = LoRa.read(); // recipient address
byte sender = LoRa.read(); // sender address
byte incomingMsgId = LoRa.read(); // incoming msg ID
byte msgLength = LoRa.read(); // incoming msg length
String incoming = LoRa.readString(); //payload of packet
// if the recipient isn't this device or broadcast,
if (recipient != localAddress && recipient != 0xFF) {
return; // skip rest of function
digitalWrite(receiveLED, LOW); // turn off receive LED
}
}