kopia lustrzana https://github.com/jgromes/RadioLib
Updated Basics (markdown)
rodzic
3c751daebd
commit
0e15ba55ef
30
Basics.md
30
Basics.md
|
@ -1,5 +1,22 @@
|
|||
The purpose if this page is to show the basic usage of the library API.
|
||||
|
||||
## Standalone Module
|
||||
1. Connect the wireless module to the Arduino. This includes connecting the appropriate communication channel (SPI bus or UART), as well as some GPIO pins. The extra pins are used for SPI chips select, hardware reset and GPIO or interrupts. Each module uses slightly different setup. For example, some modules might only have one interrupt pin, while others may have multiple. Some modules might have reset pin, others might do without one.
|
||||
|
||||
2. Provide the pin setup to the library. This is done using the `Module` constructor in the following format:
|
||||
- **SPI** modules: `Module(cs, irq, rst, gpio)`. For example: `RF69 rf = new Module(10, 2, 3);`
|
||||
- CS: this is the pin that's used as SPI chip select.
|
||||
- IRQ: this is the interrupt pin, it's usually connected to external interrupt on Arduino. It's a fast way for the module to tell Arduino something has happened - for example, a packet was received. All SPI modules have at least one interrupt pin.
|
||||
- RST: most modules have a hardware reset pin. If the module doesn't have a reset or chip enable pin (e.g. CC1101), set `rst` to `RADIOLIB_PIN_UNUSED`.
|
||||
- GPIO: this is the fourth possible pin. It's optional for most modules, but may be required for some. SX127x requires additional interrupt pin to perform CAD and blocking receive. SX126x also uses this pin as the BUSY indication pin. If not in use, this pin can be left unassigned, or set to `RADIOLIB_PIN_UNUSED`.
|
||||
- **UART** modules: `Module(tx, rx)`. For example: `ESP8266 wifi = new Module(10, 9);`
|
||||
- Note: On some platforms that do not support SoftwareSerial, an instance of `HardwareSerial` can be provided to the constructor. When no instance is specified, the constructor will default to `Serial1`:
|
||||
`ESP8266 wifi = new Module(10, 9, &Serial1);`
|
||||
|
||||
3. After the object is created, the module has to be initialized using the `begin()` method. Typically, this is done in Arduino `setup()` function. If you want to change the module settings, this can be done by providing appropriate values to the `begin()` method.
|
||||
|
||||
4. At this point, your module is ready to send or receive any data you want!
|
||||
|
||||
## Using [**RadioShield**](https://github.com/jgromes/RadioShield)
|
||||
1. Plug the wireless module into either of the two slots and select the required communication channels/GPIO pins using jumper pins.
|
||||
|
||||
|
@ -9,16 +26,3 @@ The purpose if this page is to show the basic usage of the library API.
|
|||
3. After the object is created, the module has to be initialized using the `begin()` method. Typically, this is done in Arduino `setup()` function. If you want to change the module settings, this can be done by providing appropriate values to the `begin()` method.
|
||||
|
||||
4. At this point, your module is ready to send or receive any data you want!
|
||||
|
||||
## Standalone Module
|
||||
1. Connect the wireless module to the Arduino. This includes connecting the appropriate communication channel (SPI bus or UART) and up to 2 GPIO pins. Any two digital pins can be used for UART and GPIO (unless the GPIO pins are used as external interrupts).
|
||||
|
||||
2. Provide the pin setup to the library. This is done using the `Module` constructor in the following format:
|
||||
- **SPI** modules: `Module(cs, int0, int1)`. For example: `SX1278 lora = new Module(10, 2, 3);`
|
||||
- **UART** modules: `Module(tx, rx)`. For example: `ESP8266 wifi = new Module(10, 9);`
|
||||
- Note: On ESP32 and SAMD platforms, an instance of `HardwareSerial` can be provided to the constructor. When no instance is specified, the constructor will default to `Serial1`:
|
||||
`ESP8266 wifi = new Module(10, 9, &Serial1);`
|
||||
|
||||
3. After the object is created, the module has to be initialized using the `begin()` method. Typically, this is done in Arduino `setup()` function. If you want to change the module settings, this can be done by providing appropriate values to the `begin()` method.
|
||||
|
||||
4. At this point, your module is ready to send or receive any data you want!
|
||||
|
|
Ładowanie…
Reference in New Issue