View attachment 21831
Reçus la semaine dernière: XL1276-DO1. Compatibles avec les AI Ra-01 ET la planche à pain.
L'antenne est minable, si on pète à coté, elle pète aussi. Les pattes ne sont pas fournies.
https://fr.aliexpress.com/item/LOra...-Wireless-Transceiver-Module/32322065279.html
Reçus la semaine dernière: XL1276-DO1. Compatibles avec les AI Ra-01 ET la planche à pain.
L'antenne est minable, si on pète à coté, elle pète aussi. Les pattes ne sont pas fournies.
https://fr.aliexpress.com/item/LOra...-Wireless-Transceiver-Module/32322065279.html
Code:
/* ARDUINO One Page LoRa RECEIVER
*
* AI Ra-01_V1.0 Semtech SX1278 ****** NOT BREADBOARD FRIENDLY !!!! ******
*
* LoRa Arduino
* 3.3V VCC THREE POINT THREE VOLTS !!!.!!!
* GND GND
* SCK SCK (13)
* MISO MISO (12)
* MOSI MOSI (11)
* NSS 10
* RESET 9
*/
#include <SPI.h>
const int nss = 10;
const int reset = 9;
const int lora_int = 2;
byte data = 0;
byte regIrqFlags = 0;
byte lastpacket = 0;
void setup() {
pinMode(reset,OUTPUT);
pinMode(nss, OUTPUT);
digitalWrite(nss,HIGH);
SPI.begin();
Serial.begin(9600);
// CONFIG RX
digitalWrite(reset,LOW);
delayMicroseconds(100); // reset low 100 usec
digitalWrite(reset,HIGH);
delay(10); // time to reset, mini 5 msec
digitalWrite(nss,LOW);
SPI.transfer(0x81); SPI.transfer(0x00); // Can only set LoRa mode from sleep mode
digitalWrite(nss,HIGH);
digitalWrite(nss,LOW);
SPI.transfer(0x81); SPI.transfer(0x88); // LoRa, low freq mode
digitalWrite(nss,HIGH);
digitalWrite(nss,LOW);
SPI.transfer(0x91); SPI.transfer(0xBF); // Set up flag for RX done
digitalWrite(nss,HIGH);
digitalWrite(nss,LOW);
SPI.transfer(0x81); SPI.transfer(0x8D); // RXCONTINUOUS, low freq, LoRa mode (Listen)
digitalWrite(nss,HIGH);
Serial.print("Waiting for data....");
}
void loop() {
digitalWrite(nss,LOW);
SPI.transfer(0x12); regIrqFlags = SPI.transfer(0x00); // Get regIRQFlags
digitalWrite(nss,HIGH);
if (regIrqFlags && 0x40){ // RxDone
digitalWrite(nss,LOW);
SPI.transfer(0x10); lastpacket = SPI.transfer(0x00); // Read last packet address
digitalWrite(nss,HIGH);
digitalWrite(nss,LOW);
SPI.transfer(0x8D); SPI.transfer(lastpacket); // Set FifoAddrPtr to last packet address
digitalWrite(nss,HIGH);
digitalWrite(nss,LOW);
SPI.transfer(0x00); data = SPI.transfer(0x00); // Read character from FIFO
digitalWrite(nss,HIGH);
digitalWrite(nss,LOW);
SPI.transfer(0x92); SPI.transfer(0xFF); // Clear LoRa IRQ flags
digitalWrite(nss,HIGH);
Serial.print("Received ");
Serial.println(data);
delay(50);
}
}