Added some config/init time options
This commit is contained in:
parent
fe59becbba
commit
1a92fdfc8e
|
@ -10,8 +10,8 @@
|
|||
#include <mrf24j.h>
|
||||
|
||||
const int pin_reset = 6;
|
||||
const int pin_cs = 10; // default CS pin on ATMEGA8
|
||||
const int pin_interrupt = 2; // default interrupt pin on ATMEGA8
|
||||
const int pin_cs = 10; // default CS pin on ATmega8/168/328
|
||||
const int pin_interrupt = 2; // default interrupt pin on ATmega8/168/328
|
||||
|
||||
Mrf24j mrf(pin_reset, pin_cs, pin_interrupt);
|
||||
|
||||
|
@ -20,13 +20,18 @@ long tx_interval = 1000;
|
|||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
|
||||
|
||||
mrf.reset();
|
||||
mrf.init();
|
||||
|
||||
mrf.set_pan(0xcafe);
|
||||
// This is _our_ address
|
||||
mrf.address16_write(0x6001);
|
||||
|
||||
// uncomment if you want to enable PA/LNA external control
|
||||
//mrf.set_palna(true);
|
||||
|
||||
attachInterrupt(0, interrupt_routine, CHANGE); // interrupt 0 equivalent to pin 2 on ATMEGA8
|
||||
|
||||
attachInterrupt(0, interrupt_routine, CHANGE); // interrupt 0 equivalent to pin 2(INT0) on ATmega8/168/328
|
||||
last_time = millis();
|
||||
interrupts();
|
||||
}
|
||||
|
@ -37,12 +42,6 @@ void interrupt_routine() {
|
|||
|
||||
void loop() {
|
||||
mrf.check_flags(&handle_rx, &handle_tx);
|
||||
unsigned long current_time = millis();
|
||||
if (current_time - last_time > tx_interval) {
|
||||
last_time = current_time;
|
||||
Serial.println("txxxing...");
|
||||
mrf.send16(0x4202, "abcd");
|
||||
}
|
||||
}
|
||||
|
||||
void handle_rx() {
|
||||
|
|
Loading…
Reference in New Issue