Author Topic: TxRxBlinky Sketch in RFM69 Examples  (Read 316 times)

jlskill@aol.com

  • Newbie
  • *
  • Posts: 4
TxRxBlinky Sketch in RFM69 Examples
« on: December 07, 2019, 11:12:01 PM »
In this Sketch. (Examples>RFM69_low_Power > TxRxBlinky ). I have two questions:
1) What is Rx_TOGGLE_pin  7;  used for?
    I don't see this pin on the ATMEL 328 connected to the RFM69 at all.
    Should this be Pin 10  (D10) that is  connected to RFM69 SEL input?
2) What are  LED_GREEN  4; and LED_RED  5; Used for?
  Was I supposed to Add these two LEDS to these pins, or are they already on the Moteino board (don't think so)

Thank you
  Newbie John

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6279
  • Country: us
    • LowPowerLab
Re: TxRxBlinky Sketch in RFM69 Examples
« Reply #1 on: December 08, 2019, 11:53:09 AM »
Hi John,

I tried to comment this sketch pretty heavily, but probably didn't think about the absolute beginner, my apologies.

RX_TOGGLE_PIN is just a pin that is toggled depending on the state, you can ignore it, not even sure what I had in mind for this pin.

For the additional RED/GREEN LEDs, if you take a look at the code, you will find this section:

Code: [Select]
    if(LEDSTATE==LOW)
    {
      LEDSTATE=HIGH;
      digitalWrite(LED_GREEN, HIGH);
      digitalWrite(LED_RED, LOW);
    }
    else
    {
      LEDSTATE=LOW;
      digitalWrite(LED_GREEN, LOW);
      digitalWrite(LED_RED, HIGH);
    }

As you can see, the LED_GREEN and LED_RED are toggled (only 1 is ON at 1 time) based on the state of the LEDSTATE variable, which in turn is toggled by the messaging between the 2 nodes loaded with this sketch.

It's a very very simple sketch illustrating how to ping pong a message between 2 nodes. This sketch is loaded on BOTH ends, just configure settings on each, give them unique IDs etc.

D10 (aka radio SPI CS) on Moteino is always used by the radio/SPI, it's hardwired to it.