Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 47:b6120c152ad1
- Parent:
- 46:6398237672a0
- Child:
- 48:9220d75f2571
--- a/main.cpp Tue Mar 10 12:11:13 2015 +0000
+++ b/main.cpp Thu Mar 19 12:54:28 2015 +0000
@@ -37,7 +37,7 @@
node.requestRanging(destination);
if(node.overflow){
- myprintf("Overflow! Measured: %f\r\n", node.distances[destination]);
+ myprintf("Overflow! Measured: %f\r\n", node.distances[destination]); // This is the output to see if a timer overflow was corrected by the two way ranging class
}
if (node.distances[destination] == -1) {
@@ -95,53 +95,44 @@
pc.printf("EUI register: %016llX\r\n", dw.getEUI());
pc.printf("Voltage: %fV\r\n", dw.getVoltage());
- node.isAnchor = true;
- // declare as anchor or beacon
+ node.isAnchor = true; // declare as anchor or beacon
+
if (node.isAnchor) {
- node.address = 5;
+ node.address = 1;
myprintf("This node is Anchor node %d \r\n", node.address);
} else {
node.address = 0;
myprintf("This node is a Beacon. ");
}
- if (node.address == 5){
- dw.setCallbacks(&altCallbackRX, NULL);
- }
+ if (node.address == 5){ // the node with address 5 was used as an observer node putting out the results in our test case
+ dw.setCallbacks(&altCallbackRX, NULL);
+ }
while(1) {
if (!node.isAnchor){
rangeAndDisplayAll();
//calibrationRanging(4);
-
-
-
-
- }else
- //myprintf(".\r");
-
+ } else {
+ //myprintf("."); // to see if the core and output is working
wait(0.5);
+ }
}
}
-void altCallbackRX(){
+void altCallbackRX() { // this callback was used in our verification test case for the observer node which only receives and outputs the resulting data
DistancesFrame distFrame;
float distances[4];
dw.readRegister(DW1000_RX_BUFFER, 0, (uint8_t*)&distFrame, dw.getFramelength());
- if (distFrame.destination == 5){
+ if (distFrame.destination == 5) {
for (int i = 0; i<4; i++){
- distances[i] = distFrame.dist[i];
+ myprintf("%f, ", distFrame.dist[i]);
}
-
- for (int i = 0; i < 4; i++) { // Output Results
- myprintf("%f, ", distances[i]);
-
- }
-
+
myprintf("\r\n");
}
dw.startRX();
