- Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathExample3_getFirmwareVersion.ino
84 lines (70 loc) · 3.05 KB
/
Example3_getFirmwareVersion.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*!
* @file Example3_getFirmwareVersion.ino
*
* @mainpage SparkFun Swarm Satellite Arduino Library
*
* @section intro_sec Examples
*
* This example shows how to read the firmware version) from the modem.
*
* Want to support open source hardware? Buy a board from SparkFun!
* SparkX Swarm Serial Breakout : https://www.sparkfun.com/products/19236
*
* @section author Author
*
* This library was written by:
* Paul Clark
* SparkFun Electronics
* February 2022
*
* @section license License
*
* MIT: please see LICENSE.md for the full license information
*
*/
#include<SparkFun_Swarm_Satellite_Arduino_Library.h>//Click here to get the library: http://librarymanager/All#SparkFun_Swarm_Satellite
SWARM_M138 mySwarm;
#defineswarmSerial Serial1 // Use Serial1 to communicate with the modem. Change this if required.
// If you are using the Swarm Satellite Transceiver MicroMod Function Board:
//
// The Function Board has an onboard power switch which controls the power to the modem.
// The power is disabled by default.
// To enable the power, you need to pull the correct PWR_EN pin high.
//
// Uncomment and adapt a line to match your Main Board and Processor configuration:
//#define swarmPowerEnablePin A1 // MicroMod Main Board Single (DEV-18575) : with a Processor Board that supports A1 as an output
//#define swarmPowerEnablePin 39 // MicroMod Main Board Single (DEV-18575) : with e.g. the Teensy Processor Board using pin 39 (SDIO_DATA2) to control the power
//#define swarmPowerEnablePin 4 // MicroMod Main Board Single (DEV-18575) : with e.g. the Artemis Processor Board using pin 4 (SDIO_DATA2) to control the power
//#define swarmPowerEnablePin G5 // MicroMod Main Board Double (DEV-18576) : Slot 0 with the ALT_PWR_EN0 set to G5<->PWR_EN0
//#define swarmPowerEnablePin G6 // MicroMod Main Board Double (DEV-18576) : Slot 1 with the ALT_PWR_EN1 set to G6<->PWR_EN1
voidsetup()
{
// Swarm Satellite Transceiver MicroMod Function Board PWR_EN
#ifdef swarmPowerEnablePin
pinMode(swarmPowerEnablePin, OUTPUT); // Enable modem power
digitalWrite(swarmPowerEnablePin, HIGH);
#endif
delay(1000);
Serial.begin(115200);
while (!Serial)
; // Wait for the user to open the Serial console
Serial.println(F("Swarm Satellite example"));
Serial.println();
//mySwarm.enableDebugging(); // Uncomment this line to enable debug messages on Serial
bool modemBegun = mySwarm.begin(swarmSerial); // Begin communication with the modem
while (!modemBegun) // If the begin failed, keep trying to begin communication with the modem
{
Serial.println(F("Could not communicate with the modem. It may still be booting..."));
delay(2000);
modemBegun = mySwarm.begin(swarmSerial);
}
char *firmwareVersion = newchar[SWARM_M138_MEM_ALLOC_FV]; // Create storage for the configuration settings
mySwarm.getFirmwareVersion(firmwareVersion); // Get the firmware version
Serial.print(F("The firmware version is: "));
Serial.println(firmwareVersion);
delete[] firmwareVersion; // Free the storage
}
voidloop()
{
//Nothing to do here
}