Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- To use the RockBLOCK Mk2 Iridium SatComm Module with Arduino, you'll need to install the IridiumSBD library. You can install the library from the Arduino Library Manager by searching for "IridiumSBD" and installing the latest version. Here's an example code to send a message using the RockBLOCK Mk2:
- Before uploading the code to your Arduino, wire the RockBLOCK Mk2 module as follows:
- Connect the RockBLOCK's Vin pin to the Arduino's 5V pin.
- Connect the RockBLOCK's GND pin to the Arduino's GND pin.
- Connect the RockBLOCK's TX pin to the Arduino's software serial RX pin (pin 11 in this example).
- Connect the RockBLOCK's RX pin to the Arduino's software serial TX pin (pin 10 in this example).
- Upload the code to your Arduino, and open the Serial Monitor. The Arduino will initialize the RockBLOCK Mk2 module and attempt to send the message "Hello from RockBLOCK Mk2!". If successful, it will display "Message sent successfully!" on the Serial Monitor.
- Please note that using the Iridium satellite network to send messages involves airtime costs. Make sure to manage your usage according to your subscription plan to avoid unexpected charges. Also, ensure that the RockBLOCK Mk2 module has a clear view of the sky to establish a connection with the Iridium satellite network.
- */
- #include <IridiumSBD.h>
- #include <SoftwareSerial.h>
- // Use software serial to communicate with RockBLOCK Mk2
- #define IRIDIUM_TX_PIN 10
- #define IRIDIUM_RX_PIN 11
- SoftwareSerial iridiumSerial(IRIDIUM_RX_PIN, IRIDIUM_TX_PIN);
- // Create an IridiumSBD instance
- IridiumSBD modem(iridiumSerial);
- void setup() {
- Serial.begin(9600); // Start serial communication with the computer
- iridiumSerial.begin(19200); // Start communication with the RockBLOCK Mk2
- Serial.println("Starting satellite communication...");
- // Initialize the Iridium modem (this may take a while)
- int result = modem.begin();
- if (result != ISBD_SUCCESS) {
- Serial.print("Modem initialization failed with error code ");
- Serial.println(result);
- while (1); // Halt the program if initialization fails
- }
- // Send a message
- String message = "Hello from RockBLOCK Mk2!";
- result = modem.sendSBDText(message.c_str());
- if (result != ISBD_SUCCESS) {
- Serial.print("Message sending failed with error code ");
- Serial.println(result);
- } else {
- Serial.println("Message sent successfully!");
- }
- }
- void loop() {
- // Nothing to do here, as we just send one message during setup()
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement