Skip to content

Commit ef1c49b

Browse files
version v1.0.1702.1. Fixed invalid conversion of data type bug
1 parent 0e05c03 commit ef1c49b

21 files changed

+1991
-166
lines changed

LICENSE

Lines changed: 0 additions & 165 deletions
This file was deleted.

License.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--- License Agreement ---
2+
3+
RF Explorer Arduino Libraries is Open Source software released under GPL v3, so you are free to modify, distribute and use it based on GPL terms. Visit www.gnu.org/copyleft/gpl.html for details.
4+
5+
You agree that the software is provided as-is, without warranty of any kind (either express or implied). Accordingly, we make no warranties, representations or guarantees, either express or implied, and disclaims all such warranties, representations or guarantees, including, without limitation, the implied warranties of merchantability and fitness for any particular purpose, as to: (a) the functionality or non-infringement of program, any modification, a combined work or an aggregate work; or (b) the results of any project undertaken using the program, any modification, a combined work or an aggregate work. In no event shall the contributors be liable for any direct, indirect, incidental, special, exemplary, consequential or any other damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of the program, even if advised of the possibility of such damages. You hereby waive any claims for damages of any kind against contributors which may result from your use of the firmware.
6+
7+
--- Copyright notice ---
8+
9+
RF Explorer embedded firmware and Arduino libraries software is copyrighted � by Ariel Rocholl, 2010-2016.
10+
RF Explorer is a registered trademark in USA, Australia, Japan, Canada, China an all EU Countries.
11+
12+
--- Open Source ---
13+
14+
This application is Open Source and available under GPL v3 license by Ariel Rocholl.
15+
The source code is available at http://github.com/rfexplorer and can be modified, updated and redistributed under GPL license.
16+
17+
--- More Info ---
18+
19+
For general information about RF Explorer, please visit
20+
www.rf-explorer.com
21+
22+
For details about RF Explorer IoT, please visit
23+
www.rf-explorer.com/IoT
24+
25+
For questions, please go to RF Explorer forum at
26+
www.rf-explorer.com/forum

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
# RFExplorer_3GP_IoT_Arduino
2-
Native Libraries for RF Explorer 3G+ IoT for Arduino
2+
3+
Native Libraries and examples for RF Explorer 3G+ IoT in Arduino
4+
5+
For reference and examples, please [visit wiki](http://github.com/RFExplorer/RFExplorer-IoT-for-Arduino/wiki)
6+
7+
For more details and documentation, please visit www.rf-explorer.com/IoT
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
/*
2+
3+
RF Explorer 3G+ IoT for Arduino - A Spectrum Analyzer for everyone!
4+
Copyright © 2010-17 Ariel Rocholl, www.rf-explorer.com
5+
6+
This sketch is free software; you can redistribute it and/or
7+
modify it under the terms of the GNU Lesser General Public
8+
License as published by the Free Software Foundation; either
9+
version 3.0 of the License, or (at your option) any later version.
10+
11+
-----------------------------------------------------------------
12+
13+
Example: RFE_IoT_GetPeak - Version 1.0.0 - 2016/12/01
14+
15+
General Description:
16+
Simplest example with RF Explorer 3G+ IoT capturing external Signal Peak.
17+
Use the Arduino Terminal to detect results
18+
19+
Software Description:
20+
* setup() initialize hardware and communications:
21+
* MWSUB3G module connects at 115200bps
22+
* Monitor Serial (USB debug port) remains at 57600bps
23+
* loop() continuous scan frequency range 1.180 to 1.2 GHz to detect peak signal
24+
* Everytime a new sweep scan is received, the Terminal will display frequency and power of peak signal
25+
26+
Circuit Description:
27+
* RF Explorer 3G+ IoT for Arduino
28+
* Arduino DUE
29+
* USB cable for programming and monitoring
30+
31+
Support Email: contact@rf-explorer.com
32+
33+
See: http://www.rf-explorer.com/IoT for more information
34+
35+
*/
36+
37+
#include <RFExplorer_3GP_IoT.h>
38+
39+
RFExplorer_3GP_IoT g_objRF; //Global 3G+ object for access to all RF Explorer IoT functionality
40+
41+
void setup()
42+
{
43+
digitalWrite(_RFE_GPIO2, LOW); //Set _RFE_GPIO2 as output, LOW -> Device mode to 2400bps
44+
g_objRF.resetHardware(); //Reset 3G+ board
45+
46+
delay(5000); //Wait for 3G+ to complete initialization routines
47+
g_objRF.init(); //Initialize 3G+ library - Monitor SerialDebugger set 57600bps
48+
g_objRF.changeBaudrate(115200); //Change baudrate to 115Kbps, max reliable in Arduino DUE.
49+
delay(1000); //Wait 1sec to stablish communication
50+
digitalWrite(_RFE_GPIO2, HIGH);
51+
pinMode(_RFE_GPIO2, INPUT_PULLUP); //Set _RFE_GPIO2 as a general port, no longer needed after start completed
52+
53+
g_objRF.requestConfig(); //Request of current configuration to 3G+ -> Device starts to send it setup and them SweepData
54+
}
55+
56+
void loop()
57+
{
58+
//Call to these two functions to refresh library received data.
59+
//If this function is not being called regularly, data received from 3G+ may be lost
60+
//and keep unprocessed
61+
g_objRF.updateBuffer();
62+
unsigned short int nProcessResult = g_objRF.processReceivedString();
63+
64+
//If received data processing was correct, we can use it
65+
if (nProcessResult == _RFE_SUCCESS)
66+
{
67+
if ((g_objRF.getLastMessage() == _CONFIG_MESSAGE))
68+
{
69+
//Message received is a new configuration from 3G+
70+
//We show new Start/Stop KHZ range here from the new configuration
71+
g_objRF.getMonitorSerial().println("New Config");
72+
g_objRF.getMonitorSerial().print("StartKHz: ");
73+
g_objRF.getMonitorSerial().println(g_objRF.getConfiguration()->getStartKHZ());
74+
g_objRF.getMonitorSerial().print("StopKHz: ");
75+
g_objRF.getMonitorSerial().println(g_objRF.getConfiguration()->getEndKHZ());
76+
}
77+
else if((g_objRF.getLastMessage() == _SWEEP_MESSAGE) && g_objRF.isValid())
78+
{
79+
//Message received was actual sweep data, we can now use internal functions
80+
//to get sweep data parameters
81+
unsigned long int nFreqPeakKHZ=0;
82+
int16_t nPeakDBM=0;
83+
if (g_objRF.getPeak(&nFreqPeakKHZ, &nPeakDBM) ==_RFE_SUCCESS)
84+
{
85+
//Display frequency and amplitude of the signal peak
86+
g_objRF.getMonitorSerial().print(nFreqPeakKHZ);
87+
g_objRF.getMonitorSerial().print(" KHz to ");
88+
g_objRF.getMonitorSerial().print(nPeakDBM);
89+
g_objRF.getMonitorSerial().println(" dBm");
90+
}
91+
}
92+
}
93+
else
94+
{
95+
//Message or Data was not received, or was wrong. Note:
96+
// _RFE_IGNORE or _RFE_NOT_MESSAGE are not errors, it just mean a new message was not available
97+
if ((nProcessResult != _RFE_IGNORE) && (nProcessResult != _RFE_NOT_MESSAGE))
98+
{
99+
//Other error codes were received, report for information
100+
//Check library error codes for more details
101+
g_objRF.getMonitorSerial().print("Error:");
102+
g_objRF.getMonitorSerial().println(nProcessResult);
103+
}
104+
}
105+
}

0 commit comments

Comments
 (0)