Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
1NH21CE030 Udaya Bhaskar reddy
Created September 3, 2024

Smart Wearable for Real-Time Object Recognition and Auditory

A wearable device using Nordic nRF52840 and Grove AI Kit for real-time object recognition and audio feedback

22
Smart Wearable for Real-Time Object Recognition and Auditory

Things used in this project

Story

Read more

Schematics

Images

images

Code

c code

C/C++
#include <stdio.h>
#include "nrf.h"
#include "nrf_gpio.h"
#include "nrf_uart.h"
#include "nrf_ble_qwr.h"
#include "ble_advertising.h"
#include "ble_conn_params.h"
#include "ble_nus.h"
#include "app_timer.h"

#define UART_TX_PIN   6
#define UART_RX_PIN   8
#define UART_BAUD_RATE NRF_UART_BAUDRATE_115200

static void uart_event_handler(nrf_uart_event_t event_type)
{
    // Handle UART events (e.g., data received)
}

static void uart_init(void)
{
    nrf_uart_configure(NRF_UART0, NRF_UART_PARITY_EXCLUDED, UART_BAUD_RATE);
    nrf_uart_pins_set(NRF_UART0, UART_TX_PIN, UART_RX_PIN, NRF_UART_PIN_DISCONNECTED, NRF_UART_PIN_DISCONNECTED);
    nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_RXDRDY);
    nrf_uart_int_enable(NRF_UART0, NRF_UART_INT_MASK_RXDRDY);
    nrf_uart_task_trigger(NRF_UART0, NRF_UART_TASK_STARTRX);
    nrf_uart_task_trigger(NRF_UART0, NRF_UART_TASK_STARTTX);
}

static void ble_nus_data_handler(const uint8_t *data, uint16_t length)
{
    // Handle received data from BLE NUS
    // Process object recognition results
}

int main(void)
{
    uart_init();

    // Initialize BLE stack and services
    ble_nus_init();
    ble_advertising_start();

    while (true)
    {
        // Main loop
        __WFE(); // Wait for event
    }
}

Credits

1NH21CE030 Udaya Bhaskar reddy

1NH21CE030 Udaya Bhaskar reddy

1 project • 1 follower

Comments