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!
MATHUKU GOUTHAM REDDY
Created September 3, 2024

Developing an Accessible Educational System

Developing an Accessible Educational System for Visually Impaired Students

18
Developing an Accessible Educational System

Things used in this project

Story

Read more

Code

code 1

C/C++
#include <WiFi.h>
#include <HTTPClient.h>

// WiFi credentials
const char* ssid = "your_SSID";
const char* password = "your_PASSWORD";

// URL of the educational content
const char* url = "https://example.com/educational-content.txt";

void setup() {
    Serial.begin(115200);
    WiFi.begin(ssid, password);

    // Wait for connection
    while (WiFi.status() != WL_CONNECTED) {
        delay(500);
        Serial.print(".");
    }
    Serial.println("Connected to WiFi");

    // Fetch content
    HTTPClient http;
    http.begin(url);
    int httpCode = http.GET();

    if (httpCode == HTTP_CODE_OK) {
        String payload = http.getString();
        Serial.println("Content fetched:");
        Serial.println(payload);
        // Send this payload via Bluetooth or other means
    } else {
        Serial.println("Error fetching content");
    }

    http.end();
}

void loop() {
    // Nothing to do here
}

code 2

C/C++
#include <nrf_ble_gatt.h>
#include <ble_nus.h>
#include <nrf_log.h>
#include <nrf_log_ctrl.h>
#include <nrf_log_default_backends.h>

#define DEVICE_NAME "BLE_Text_Transmitter"

static ble_nus_t m_nus;
static nrf_ble_gatt_t m_gatt;

static void ble_evt_handler(ble_evt_t const * p_ble_evt) {
    // Handle BLE events here
}

static void nus_data_handler(ble_nus_evt_t * p_evt) {
    if (p_evt->type == BLE_NUS_EVT_RX_DATA) {
        // Handle received data here
        NRF_LOG_INFO("Received data: %s", p_evt->params.rx_data.p_data);
        // Forward data to the ESP32-S3
    }
}

void services_init(void) {
    ble_nus_init_t nus_init = {0};
    nus_init.data_handler = nus_data_handler;
    ble_nus_init(&m_nus, &nus_init);
}

int main(void) {
    NRF_LOG_INIT(NULL);
    NRF_LOG_DEFAULT_BACKENDS_INIT();

    ble_stack_init();
    gap_params_init();
    gatt_init();
    services_init();
    advertising_start();

    while (true) {
        NRF_LOG_FLUSH();
        sd_app_evt_wait();
    }
}

code 3

C/C++
#include <BluetoothSerial.h>
#include <Wire.h>
#include <Adafruit_Soundboard.h>

BluetoothSerial SerialBT;
String receivedText = "";

void setup() {
    Serial.begin(115200);
    SerialBT.begin("ESP32S3_Speaker"); // Start Bluetooth Serial
    Serial.println("Bluetooth Started");

    // Initialize the TTS library if needed
}

void loop() {
    if (SerialBT.available()) {
        receivedText = SerialBT.readStringUntil('\n');
        Serial.println("Received Text: " + receivedText);
        // Convert receivedText to speech
        // Placeholder for TTS library or API integration
        // For example: ttsLibrary.speak(receivedText);
    }
}

Credits

MATHUKU GOUTHAM REDDY

MATHUKU GOUTHAM REDDY

1 project • 1 follower

Comments