I purchased a UWB module that is BU01 and also soldered it on the esp8266 board but had a running issue on the code itself since it outputs useless hex data not the actual code...
please help coz I have a submission this Sunday
The code:
#include <SPI.h>
#include "DW1000Ranging.h"
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
// Connection pins
const uint8_t PIN_SS = 17;
const uint8_t PIN_RST = 30;
const uint8_t PIN_IRQ = 26;
const uint8_t PIN_SCK_AVAILABLE = 23;
const uint8_t PIN_SCK_NOT_AVAILABLE = SCK;
const uint8_t PIN_MISO_AVAILABLE = 22;
const uint8_t PIN_MISO_NOT_AVAILABLE = MISO;
const uint8_t PIN_MOSI_AVAILABLE = 21;
const uint8_t PIN_MOSI_NOT_AVAILABLE = MOSI;
const char *ssid = "B_Pixel";
const char *password = "Pixel 126";
const char *udpAddress = "192.168.0.112"; // My UDP Server IP
const int udpPort = 8080;
void setup() {
Serial.begin(115200);
delay(1000);
uint8_t pinSCK = PIN_SCK_AVAILABLE != 0 ? PIN_SCK_AVAILABLE : PIN_SCK_NOT_AVAILABLE;
uint8_t pinMISO = PIN_MISO_AVAILABLE != 0 ? PIN_MISO_AVAILABLE : PIN_MISO_NOT_AVAILABLE;
uint8_t pinMOSI = PIN_MOSI_AVAILABLE != 0 ? PIN_MOSI_AVAILABLE : PIN_MOSI_NOT_AVAILABLE;
SPI.begin();
DW1000Ranging.initCommunication(PIN_RST, PIN_SS, PIN_IRQ);
// DW1000Ranging.startAsAnchor("DD:CC:5B:D5:A9:9A:E2:9C", DW1000.MODE_LONGDATA_RANGE_LOWPOWER, false);
// DW1000Ranging.startAsAnchor("BB:AA:5B:D5:A9:9A:E2:9C", DW1000.MODE_LONGDATA_RANGE_LOWPOWER, false);
const char* anchorAddress = "BB:AA:5B:D5:A9:9A:E2:9C";
DW1000Ranging.startAsAnchor(const_cast<char*>("BB:AA:5B:D5:A9:9A:E2:9C"), DW1000.MODE_LONGDATA_RANGE_LOWPOWER, false);
}
void loop() {
DW1000Ranging.loop();
}
void newRange() {
updateRange(DW1000Ranging.getDistantDevice()->getRange());
}
void newBlink(DW1000Device* device) {
}
void inactiveDevice(DW1000Device* device) {
}
void updateRange(float range) {
}