CARVIEW |
Select Language
HTTP/2 200
date: Sun, 12 Oct 2025 02:55:19 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=1b0d9815f91972cd071faf2ee3c2ee6df9f9556378169684945d98bef026910fa%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22ZeWfDY0XEa8qZC6AtrDHQjwtXjfELmtt%22%3B%7D; HttpOnly; Path=/
cf-ray: 98d351520977cf00-BLR
BLE Telemetry rev_01 - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********* Pleasedontcode.com **********
- Pleasedontcode thanks you for automatic code generation! Enjoy your code!
- - Terms and Conditions:
- You have a non-exclusive, revocable, worldwide, royalty-free license
- for personal and commercial use. Attribution is optional; modifications
- are allowed, but you're responsible for code maintenance. We're not
- liable for any loss or damage. For full terms,
- please visit pleasedontcode.com/termsandconditions.
- - Project: BLE Telemetry
- - Source Code NOT compiled for: ESP32 DevKit V1
- - Source Code created on: 2025-09-21 08:59:25
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* We want the sensors to show their output in the */
- /* app serial bluetooth */
- /****** END SYSTEM REQUIREMENTS *****/
- /* START CODE */
- /****** DEFINITION OF LIBRARIES *****/
- #include <Wire.h>
- #include <MPU6050.h> // https://github.com/electroniccats/mpu6050
- #include <Adafruit_BME280.h>
- #include <Adafruit_Sensor.h>
- #include <BLEDevice.h>
- #include <BLEServer.h>
- #include <BLEUtils.h>
- #include <BLE2902.h>
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- /***** DEFINITION OF DIGITAL INPUT PINS *****/
- const uint8_t M1_MPU6050_Interrupt_PIN_D4 = 4;
- /***** DEFINITION OF I2C PINS *****/
- const uint8_t M1_MPU6050_I2C_PIN_SDA_D21 = 21;
- const uint8_t M1_MPU6050_I2C_PIN_SCL_D22 = 22;
- const uint8_t M1_MPU6050_I2C_SLAVE_ADDRESS = 104; // 0x68
- /****** DEFINITION OF BUFFERS/DEVICES *****/
- // BME280 I2C address (commonly 0x76 or 0x77)
- #define BME280_I2C_ADDRESS 0x76
- /****** DEFINITION OF LIBRARIES CLASS INSTANCES *****/
- MPU6050 mpu(M1_MPU6050_I2C_SLAVE_ADDRESS);
- Adafruit_BME280 bme; // I2C
- // BLE (Nordic UART Service) definitions
- static boolean bleInitialized = false;
- static boolean deviceConnected = false;
- #define BLE_SERVICE_UUID "6e400001-b5a3-f393-e0a9-e50e24dcca9e" // NUS service
- #define BLE_NUS_TX_CHAR_UUID "6e400003-b5a3-f393-e0a9-e50e24dcca9e" // TX from device (notify)
- #define BLE_NUS_RX_CHAR_UUID "6e400002-b5a3-f393-e0a9-e50e24dcca9e" // RX to device (write)
- BLECharacteristic *pTxCharacteristic = nullptr;
- BLECharacteristic *pRxCharacteristic = nullptr;
- // Server callbacks to track connection state
- class MyServerCallbacks: public BLEServerCallbacks {
- void onConnect(BLEServer* pServer) {
- deviceConnected = true;
- }
- void onDisconnect(BLEServer* pServer) {
- deviceConnected = false;
- }
- };
- // Optional: RX callback (not strictly needed unless you want to process data from central)
- class MyRxCallbacks: public BLECharacteristicCallbacks {
- void onWrite(BLECharacteristic *pCharacteristic) {
- // Data received from central (not used in this example)
- }
- };
- void setup(void)
- {
- // put your setup code here, to run once:
- Serial.begin(115200);
- while (!Serial) { delay(10); } // wait for Serial
- // Initialize I2C
- Wire.begin(M1_MPU6050_I2C_PIN_SDA_D21, M1_MPU6050_I2C_PIN_SCL_D22, 100000);
- // Mount/interfacing sensors
- // BME280 setup
- if (!bme.begin(BME280_I2C_ADDRESS)) {
- Serial.println("Could not find BME280 sensor. Check wiring!");
- while (1) { delay(1000); }
- }
- Serial.println("BME280 initialized");
- // MPU6050 setup
- mpu.initialize();
- // Basic check (some libraries provide testConnection; adjust if needed)
- // if (!mpu.testConnection()) Serial.println("MPU6050 connection failed!");
- Serial.println("MPU6050 initialized");
- // Optional: configure interrupt pin if used
- pinMode(M1_MPU6050_Interrupt_PIN_D4, INPUT);
- // Initialize BLE (NUS)
- Serial.println("Initializing BLE...");
- BLEDevice::init("MissilePod");
- BLEServer *pServer = BLEDevice::createServer();
- pServer->setCallbacks(new MyServerCallbacks());
- BLEService *pService = pServer->createService(BLE_SERVICE_UUID);
- pTxCharacteristic = pService->createCharacteristic(BLE_NUS_TX_CHAR_UUID, BLECharacteristic::PROPERTY_NOTIFY);
- pRxCharacteristic = pService->createCharacteristic(BLE_NUS_RX_CHAR_UUID, BLECharacteristic::PROPERTY_WRITE);
- pRxCharacteristic->setCallbacks(new MyRxCallbacks());
- // Start the service
- pService->start();
- // Start advertising
- BLEAdvertising *pAdvertising = BLEDevice::getAdvertising();
- pAdvertising->addServiceUUID(BLE_SERVICE_UUID);
- pAdvertising->setScanResponse(true);
- pAdvertising->start();
- bleInitialized = true;
- Serial.println("BLE initialized. Waiting for connections...");
- }
- void loop(void)
- {
- // put your main code here, to run repeatedly:
- // --- Get BME280 data ---
- float temp = bme.readTemperature();
- float pressure = bme.readPressure() / 100.0f; // Pa to hPa
- float humidity = bme.readHumidity();
- // --- Get MPU6050 data ---
- int16_t ax, ay, az, gx, gy, gz;
- // The function name depends on the library version. Commonly:
- mpu.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
- // Prepare data string (Arduino String for easy BLE/PIN string handling)
- String data = "Temp: " + String(temp, 2) +
- ", Pressure: " + String(pressure, 2) +
- ", Humidity: " + String(humidity, 2) +
- ", Accel: X=" + String(ax) + " Y=" + String(ay) + " Z=" + String(az) +
- ", Gyro: X=" + String(gx) + " Y=" + String(gy) + " Z=" + String(gz);
- Serial.println(data); // Debug on serial monitor
- // Send over Bluetooth if connected (NUS TX characteristic)
- if (bleInitialized && deviceConnected && pTxCharacteristic != nullptr) {
- pTxCharacteristic->setValue((uint8_t*)data.c_str(), data.length());
- pTxCharacteristic->notify();
- }
- // Match the Python loop delay
- delay(1000);
- }
- /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
-
⭐✅ Swapzone Glitch ✅ Working ⭐⭐ P
JavaScript | 9 sec ago | 0.25 KB
-
✅ Make $2500 in 20 minutes⭐⭐⭐ E
JavaScript | 18 sec ago | 0.25 KB
-
📌 Swapzone +37% glitch ⭐ T
JavaScript | 26 sec ago | 0.25 KB
-
✅⭐ Make huge profits on trading ⭐⭐ B
JavaScript | 35 sec ago | 0.25 KB
-
⭐✅ Marketplace Glitch ✅ Working ✅ NEVER SEEN...
JavaScript | 44 sec ago | 0.25 KB
-
⭐✅ Exploit 2500$ in 15 Minutes⭐⭐⭐ O
JavaScript | 53 sec ago | 0.25 KB
-
Free Crypto Method (NEVER SEEN BEFORE)⭐⭐ 7
JavaScript | 1 min ago | 0.25 KB
-
⭐✅ Swapzone Glitch ✅ Working ⭐⭐ P
JavaScript | 1 min ago | 0.25 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand