Compare commits

..

No commits in common. "8f601ec030480be0ae731f443b3aa9c0d7e7067f" and "a7cf62b9ebd5644837d4435c5991f5e2e9c42f92" have entirely different histories.

3 changed files with 15 additions and 91 deletions

View File

@ -1,39 +0,0 @@
#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEServer.h>
// See the following for generating UUIDs:
// https://www.uuidgenerator.net/
#define SERVICE_UUID "4fafc201-1fb5-459e-8fcc-c5c9c331914b"
#define CHARACTERISTIC_UUID "beb5483e-36e1-4688-b7f5-ea07361b26a8"
void setup() {
Serial.begin(115200);
Serial.println("Starting BLE work!");
BLEDevice::init("Long name works now");
BLEServer *pServer = BLEDevice::createServer();
BLEService *pService = pServer->createService(SERVICE_UUID);
BLECharacteristic *pCharacteristic = pService->createCharacteristic(
CHARACTERISTIC_UUID,
BLECharacteristic::PROPERTY_READ |
BLECharacteristic::PROPERTY_WRITE
);
pCharacteristic->setValue("Hello World says Neil");
pService->start();
// BLEAdvertising *pAdvertising = pServer->getAdvertising(); // this still is working for backward compatibility
BLEAdvertising *pAdvertising = BLEDevice::getAdvertising();
pAdvertising->addServiceUUID(SERVICE_UUID);
pAdvertising->setScanResponse(true);
pAdvertising->setMinPreferred(0x06); // functions that help with iPhone connections issue
pAdvertising->setMinPreferred(0x12);
BLEDevice::startAdvertising();
Serial.println("Characteristic defined! Now you can read it in your phone!");
}
void loop() {
// put your main code here, to run repeatedly:
delay(2000);
}

View File

@ -1,6 +0,0 @@
{
"requires": [
"CONFIG_BT_ENABLED=y",
"CONFIG_BLUEDROID_ENABLED=y"
]
}

View File

@ -1,29 +1,11 @@
// Include Section
#include "esp_dmx.h"
#include "BluetoothSerial.h"
#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEServer.h>
// Name of Bluetooth client.
String BTDeviceName = "3D_SkyLED_LEDBoard";
String BTMacAddress;
// Check if Bluetooth is available.
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled!
#endif
// Check if Serial Port Profile (SPP) is available.
#if !defined(CONFIG_BT_SPP_ENABLED)
#error Serial Port Profile for Bluetooth is not available or not enabled!
#endif
// Define Section
#define BT_DISCOVER_TIME 30000
#define INTERRUPT_PIN 0
BluetoothSerial SerialBT;
char btmessage;
#define ledPin 2
#define INTERRUPT_PIN 0
struct Button {
const uint8_t PIN;
@ -31,14 +13,6 @@ struct Button {
bool pressed;
};
struct Panel {
int led0;
int led1;
int led2;
int led3;
};
// Defining BOOT button on ESP32 as our built-in button.
Button button1 = {INTERRUPT_PIN, 0, false};
@ -174,7 +148,7 @@ uint8_t dataSeq[modeAmount][DMX_PACKET_SIZE] =
{
0,
//Start Inner Round
0,0,universalBrightness,0,
universalBrightness,0,0,0,
0,0,0,0,
0,0,0,0,
0,0,0,0,
@ -235,30 +209,30 @@ void dmxSetup() {
Serial.print("Done");
// ...and then set the communication pins!
const int tx_pin = 23;
const int rx_pin = 22;
const int tx_pin = 18;
const int rx_pin = 5;
const int rts_pin = 21;
Serial.printf("\nSetting up pin %d as Transmit Pin, pin %d as Receive Pin and pin %d as RTS Pin... ", tx_pin, rx_pin, rts_pin);
dmx_set_pin(dmx_num, tx_pin, rx_pin, rts_pin);
Serial.print("Done\n");
}
void serialRead(){
String incomingByte;
int serialRead(){
int incomingByte;
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.readStringUntil('\r\n');
Serial.print("\nI received: ");
Serial.print(incomingByte);
mode = incomingByte.toInt();
incomingByte = Serial.read();
// say what you got:
Serial.print("I received: ");
Serial.println(incomingByte, DEC);
}
return incomingByte;
}
void setup() {
Serial.begin(115200);
SerialBT.begin(BTDeviceName);
BTMacAddress = SerialBT.getBtAddressString();
Serial.println(BTMacAddress.c_str());
pinMode(ledPin,OUTPUT);
pinMode(INTERRUPT_PIN, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(INTERRUPT_PIN), isr, RISING);
delay(2000);
@ -280,9 +254,4 @@ void loop() {
dmx_wait_sent(DMX_NUM_1, DMX_TIMEOUT_TICK);
// Now write the packet synchronously!
dmx_write(DMX_NUM_1, dataSeq[mode], 100);
serialRead();
if (SerialBT.available()) {
btmessage=SerialBT.read();
Serial.print(btmessage);
};
}