2024.11.25 21:56 Butterspaceflight ESP32 VROOM disconnects immediately after connecting with bluetooth
I want to send signal from an accelerometer, trough esp32 to my computer wirelessly to make a midi instrument from movement, and when it connects with bluetooth, it disconnects right away, what can I do? Thank you! Code here! // --- Phase 1: Conceptualization --- // This code ensures the ESP32 maintains a strong Bluetooth connection to a computer, // while sending smoothed MIDI data between 0 and 127 from an MPU6050 sensor. // A "keep-alive" signal is implemented to maintain Bluetooth stability. #include // I2C library for MPU6050 communication #include "BluetoothSerial.h" // Bluetooth library for ESP32 // --- Phase 2: Variable Definition and Initialization --- // Defining constants, variables, and parameters to ensure smooth operation. const int MPU_ADDR = 0x68; // I2C address for MPU6050 BluetoothSerial SerialBT; // Bluetooth Serial object // Variables to store raw and smoothed sensor data int16_t accX, accY, accZ, gyroX, gyroY, gyroZ; float smoothedAccX = 0, smoothedAccY = 0, smoothedAccZ = 0; float smoothedGyroX = 0, smoothedGyroY = 0, smoothedGyroZ = 0; // Smoothing factor for exponential smoothing const float smoothingFactor = 0.2; // Timing variables for maintaining connection stability unsigned long lastHeartbeat = 0; unsigned long keepAliveInterval = 5000; // Interval for sending the "keep-alive" signal // --- Phase 3: Setup --- // Prepare the ESP32 for a powerful and lasting Bluetooth connection. void setup() { Serial.begin(115200); // Debugging communication Wire.begin(21, 22); // I2C pins (SDA on GPIO 21, SCL on GPIO 22) // Bluetooth initialization if (!SerialBT.begin("ESP32_MIDI")) { // Naming the Bluetooth device Serial.println("Bluetooth initialization failed!"); while (true); // Halt if Bluetooth fails } Serial.println("Bluetooth MIDI started. Pair with ESP32_MIDI."); // Initialize MPU6050 if (!initializeMPU6050()) { Serial.println("MPU6050 initialization failed. Check connections."); while (true); // Halt if MPU6050 fails } Serial.println("Setup complete."); } // --- Phase 4: Loop --- // The main execution loop ensures data flow and Bluetooth stability. void loop() { if (!SerialBT.hasClient()) { // Check if Bluetooth client is connected Serial.println("Waiting for Bluetooth client..."); delay(1000); return; // Skip the rest of the loop if no client is connected } // Send keep-alive signal periodically if (millis() - lastHeartbeat >= keepAliveInterval) { SerialBT.println("KEEP_ALIVE"); Serial.println("KEEP_ALIVE signal sent."); lastHeartbeat = millis(); } // Process MPU6050 sensor data if (readMPU6050()) { // Apply exponential smoothing to sensor data smoothedAccX += smoothingFactor * (accX - smoothedAccX); smoothedAccY += smoothingFactor * (accY - smoothedAccY); smoothedAccZ += smoothingFactor * (accZ - smoothedAccZ); smoothedGyroX += smoothingFactor * (gyroX - smoothedGyroX); smoothedGyroY += smoothingFactor * (gyroY - smoothedGyroY); smoothedGyroZ += smoothingFactor * (gyroZ - smoothedGyroZ); // Map smoothed sensor values to MIDI range (0-127) byte midiAccX = constrain(map(smoothedAccX, -17000, 17000, 0, 127), 0, 127); byte midiAccY = constrain(map(smoothedAccY, -17000, 17000, 0, 127), 0, 127); byte midiAccZ = constrain(map(smoothedAccZ, -17000, 17000, 0, 127), 0, 127); byte midiGyroX = constrain(map(smoothedGyroX, -17000, 17000, 0, 127), 0, 127); byte midiGyroY = constrain(map(smoothedGyroY, -17000, 17000, 0, 127), 0, 127); byte midiGyroZ = constrain(map(smoothedGyroZ, -17000, 17000, 0, 127), 0, 127); // Send MIDI Control Change messages via Bluetooth sendMIDI(0xB0, 1, midiAccX); sendMIDI(0xB0, 2, midiAccY); sendMIDI(0xB0, 3, midiAccZ); sendMIDI(0xB0, 4, midiGyroX); sendMIDI(0xB0, 5, midiGyroY); sendMIDI(0xB0, 6, midiGyroZ); } delay(20); // Delay to manage message rate } // --- Phase 5: Auxiliary Functions --- // Additional functions to ensure clarity, stability, and precision. // Function to initialize MPU6050 bool initializeMPU6050() { Wire.beginTransmission(MPU_ADDR); Wire.write(0x6B); // Wake up MPU6050 Wire.write(0); return Wire.endTransmission(true) == 0; // Return true if successful } // Function to read data from MPU6050 bool readMPU6050() { Wire.beginTransmission(MPU_ADDR); Wire.write(0x3B); // Start reading accelerometer data if (Wire.endTransmission(false) != 0) return false; if (Wire.requestFrom(MPU_ADDR, 14, true) != 14) return false; accX = Wire.read() << 8 | Wire.read(); accY = Wire.read() << 8 | Wire.read(); accZ = Wire.read() << 8 | Wire.read(); gyroX = Wire.read() << 8 | Wire.read(); gyroY = Wire.read() << 8 | Wire.read(); gyroZ = Wire.read() << 8 | Wire.read(); return true; } // Function to send MIDI messages void sendMIDI(byte command, byte data1, byte data2) { if ((command & 0xF0) >= 0x80 && (command & 0xF0) <= 0xEF && data1 <= 127 && data2 <= 127) { SerialBT.write(command); SerialBT.write(data1); SerialBT.write(data2); Serial.print("MIDI Sent: "); Serial.print("Command="); Serial.print(command, HEX); Serial.print(", Data1="); Serial.print(data1, HEX); Serial.print(", Data2="); Serial.println(data2, HEX); } else { Serial.println("Invalid MIDI message skipped."); } }
submitted by Butterspaceflight to esp32 [link] [comments]
2024.11.25 21:56 NormalVictory96 Come obey and follow da.ddys rules!
submitted by NormalVictory96 to Snapchatgerman [link] [comments]
2024.11.25 21:56 Calm-Spirit-812 Based on Hamaguchi’s comments on wanting to explore more of the FFVII universe after Part 3, will we get an FF7-2 set post Dirge of Cerberus?
We could get Shelke in the party and finally follow up on the Dirge secret ending with Genesis.
submitted by Calm-Spirit-812 to FFVIIRemake [link] [comments]
2024.11.25 21:56 Rough_Economy_1747 iso nametag painting advice
i’m wanting to make a few cute name tags like i’ve seen others do but im not super artsy, i’m hoping some of you may have recommendations for the best paint pens and sealants to use :) tyia
submitted by Rough_Economy_1747 to starbucks [link] [comments]
2024.11.25 21:56 USPromoGuy MNF Sign Up Promos
Best NFL November 2024 Sportsbook and Sports Betting Sign Up Promos and Bonuses
2024.11.25 21:56 MayuraEsc Another Eurovision reference in Spanish Wordle's La Frase Del Día mode
submitted by MayuraEsc to eurovision [link] [comments]
2024.11.25 21:56 Massive_Vegetable390 I love this new piece!
Very versatile! submitted by Massive_Vegetable390 to RDRSuperstar [link] [comments] |
2024.11.25 21:56 Swimming-Carry2268 Get $75 off AT&T with a Refer-a-Friend promo code (I made a site with an active code!) 🙌
Hey everyone! 👋
When I was signing up for AT&T, I really wanted to use the $75 Refer-a-Friend promo, but finding a working code was such a pain. Most of the links I found were either expired or just straight-up didn’t work.
So, I decided to make my own site to fix that! It’s called attpromocode.com, and it has active Refer-a-Friend promo code that actually works for "AT&T Wireless" and "AT&T Fiber". No more wasting hours hunting around like I did!
If you’re signing up for AT&T, this should make it super easy to get the $75 discount. Hope it saves you some time and money! Let me know if it works for you—I’d love to hear about it.
submitted by Swimming-Carry2268 to ATT [link] [comments]
2024.11.25 21:56 jormahoo Red shark mogging Burt
submitted by jormahoo to fishtanklive [link] [comments] |
2024.11.25 21:56 Ill_Advantage361 Oh the burnout
I am finding it so hard to stay motivated. I don't know if it's burnout or....what? I've been in this role 7 months. I had zero training, it's a new role. I really don't know what i'm doing. My boss is a great lady but a total go-getter. I don't think she ever takes a break. She's responsive if I say I need clarification etc...but she has me pivot constantly and I don't think she remembers if she told me about the pivot. Just invites me to these random meetings where i'm like.....what am I doing here. She has her hand in SO many pots and wants me there with her. it's like there is so much to do I don't know where to start, so I just don't.
submitted by Ill_Advantage361 to corporatecringe [link] [comments]
2024.11.25 21:56 RetroGamingKnight Sneak peak into what I'm working on.
submitted by RetroGamingKnight to slavestodarkness [link] [comments] |
2024.11.25 21:56 RingsideAddiction AEW Grand Slam Australia to Move From Suncorp Stadium Due To Low Ticket Sales. Details on FB Page.
submitted by RingsideAddiction to RingsideAddiction [link] [comments] |
2024.11.25 21:56 Just-Importance-6238 Rush Royale Account for sell
High end account for sell 1500$ After last updated i just playing and the account i bought it from someone 6 months ago so I don’t have all purchases ID for more info DM me on discord (leader007) submitted by Just-Importance-6238 to RushRoyale [link] [comments] |
2024.11.25 21:56 MrTenacious30 34[M4F] New York/Nearby PA- Home after a long day at work.. looking for someone to enjoy some of my free time with..
Another year survived. Hoping I can spend this next year living, rather than just surviving. Having someone like-minded to spend some of free time and share deep thoughts with sounds fun. Enjoying the exploration of each other's minds, as much as we enjoy exploring each other's bodies..
When I'm not messing around with my music I enjoy a wee bit of gaming and watching something with a bit of dark humor in it.Daily enjoyer of bush burning because it helps me deal with the how lousy life can be, and it helps with my creativity. Not like its a necessity, but its something I embrace my enjoyment of. Prefer it to sipping spirits at a bar, although with the right person that could be fun to do again too.
Maybe those are topics of discussion we could start with if you're interested. Or we could talk about why pumpkin spice isn't the highlight of the fall season like the commercial world makes it out to be. Discuss why we are looking forward to, or dreading, the upcoming holidays.. Hopefully you enjoy a sprinkle, if not a soaking, of sarcasm mixed into the conversation. It's one of my preferred brands of humor..
Physically-5'9, blue eyed, fairly fit, and pale white because I only enjoy dwelling in the darkness of the night..
Send a pic in your message if you like what you read and I'll send one back. If we both like what we see maybe that means the conversation will carry on longer than a day.
But, yeah.. If you want details I trust you're capable of figuring out more. I mean, you got this far. Right? 🤷🕺
submitted by MrTenacious30 to r4r [link] [comments]
2024.11.25 21:56 h-musicfr For those like me who like to have music on the background while studying
Here is Mental food, a neatly curated playlist regularly updated with gems of chill electronica, IDM and downtempo music. Deep vibes for concentration and relaxation. Prefect for staying focused during my study session or relaxing after work. Hope this can help you too.
https://open.spotify.com/playlist/52bUff1hDnsN5UJpXyGLSC?si=vFiVUEdJQ22UyxA40bFSkA
H-Music
submitted by h-musicfr to CollegeEssays [link] [comments]
2024.11.25 21:56 ElBartimaeus Why did I draw 9 cards?
submitted by ElBartimaeus to slaythespire [link] [comments] |
2024.11.25 21:56 Ok_Channel_7923 Manifested Love/ Sp
So i was trying to manifest my ex boyfriend for months since he broke up w me in april this year. actually he is a toxic person but i manifested that he is obsessed with me and that he would change completely because he never listened to me, he never took me seriously, did not know how a relationship works and he’s an idiot tbh never thinks before saying something. I manifested with affirmations but mostly with the the law of assumption. I acted like i am his wife and imagined how he texted me obsessive messages. First it was going to a right direction he invited me to the cinema etc. but then suddenly he was quite and did not text me anymore. Randomly he called me at 1 am and he was crying, so he told me he had an affair with his BEST FRIENDS GIRLFRIEND (so the girlfriend basically cheated and yea he had something with her) so i sum it up after that it got worse and worse, i found out that he is the worst person and the biggest liar, but i chose that i still manifest him (dumb right ?) in those months i always saw the number 111 and now i know what it meant for me. So there was a Halloween party and my ex was there AND someone special… I met this special boy on 31 October and really talked and connected with him until the night so on the 1st nov (that explains the 111= 1.11) this person was everything i ever wanted. He listened to me, he is heart warming etc. he also said he felt a connection instantly. After 1 week still manifesting my ex even tho i met this beautiful person, i found the out that my ex is like the worst person and cheated on me and actually still lied to me all the time. So i said it’s enough i never deserved that At the same moment this special boy I met on the Halloween party texted me and omg he is perfect, he is everything I ever wanted, he is completely obsessed with me and I’m just the happiest. I blocked my ex and deleted him and I have zero feelings for him. This boy and I are not in a relationship YET but we are going to because we already kissed and had dates etc. and he is very obsessed with me just perfect… What I want to let you know: sometimes the universe gives you something better than that just trust the process, I was never happier
submitted by Ok_Channel_7923 to ManifestationSP [link] [comments]
2024.11.25 21:56 Friendly_Wack LV loom connectors discussion
Hi everyone,
I’m looking for recommendations and insights into your experiences with various LV connectors.
While I think we can all agree that having connectors on your wiring looms is a huge benefit, mil-spec connectors are often prohibitively expensive. Brands like Souriau, Deutsch, Fischer, and LEMO are top-tier options, but their price range is extremely difficult to justify.
Browsing through Mouser, RS etc., you’ll find literally hundreds of thousands of options, which makes narrowing down good alternatives quite hard.
That’s why I’m reaching out to ask: what connectors have your teams used, and what were your experiences with them? Were they worth the investment? How well did they hold up over time? What advantages or disadvantages did you notice?
(Just to clarify, these connectors will primarily be used to quickly disconnect devices from the car for inspection or maintenance.)
Thanks in advance for your input!
submitted by Friendly_Wack to FSAE [link] [comments]
2024.11.25 21:56 ulheni how does outlier work?
hi!
I just created my profile on Outlier and I'm not sure how it works, should I wait to be assigned tasks or look for projects in the marketplace? I don't see anything on the home page, can anyone give me some guidance, please?!
submitted by ulheni to outlier_ai [link] [comments]
2024.11.25 21:56 teacoffeecats How do you guys “advocate” for yourselves?
Advocate is in quotations cos I’m quoting my teacher training provider who say I have to start advocating for myself.
If I’m honest I’m not used to it at all like I genuinely don’t know where to begin I know it might sound stupid but I’m being so serious. Like usually when I notice I’ve had an additional need, if there hasn’t been accommodations for me I’ve just found a way to make it work for myself and I thought this was a good thing because it’s made me good at problem solving but at the same time it would just be easier if I was open and upfront about my condition but that’s really hard for me because I struggle to ask for help because I’m used to dealing with everything by myself and plus my household/culture isn’t the most understanding about my CP. Like my family understand certain physical needs I have but it’s limited to just that. They don’t understand the cognitive affects of CP or that CP is brain damage.
Can anyone here help me?
submitted by teacoffeecats to CerebralPalsy [link] [comments]
2024.11.25 21:56 Spiral_Doom_ Possibile trasferimento di lavoro
Ciao, sto valutando un'offerta di lavoro che mi porterebbe a trasferirmi dal Sud-Est ad Udine.
Mi consigliereste di trovare casa in affitto ad Udine o nei paesi/comuni vicini (l'ufficio sarebbe a Buttrio)?
Com'è in media il costo della vita? Come sono le città e Udine, dal punto di vista della vita nel quotidiano?
Grazie.
submitted by Spiral_Doom_ to Udine [link] [comments]
2024.11.25 21:56 GuiltilyMobilize11 F22
submitted by GuiltilyMobilize11 to AmIhotAF [link] [comments] |
2024.11.25 21:56 Weirdskinnyguy Starting point for developing, scanning and printing
Hey everyone, I'm new to this community and it's awesome. I'm looking for advice relating to the title. Some context:
I recently picked up my first film camera, a Yashica Electro 35 ($12USD with original flash and filters!), and found a battery adaptor to power the light meter, LED indicators and subsequent shutter speed. I've shot a couple of pretty nice rolls (400 color plus) and had them developed and scanned professionally with pleasing results.
I'm moving to a pretty remote country in Asia soon, with an easy connection to Bangkok. I'm not militant about anything beyond the quality of my Yashica just yet (the bit of fungus on the lens gives it character) but I'd like to establish a rudimentary dark room set-up to begin developing, scanning and printing my own photos.
I understand it is probably a common question, and I've done a fair bit of poking around and googling myself, but if anybody has a moment to post a few links below that would be really helpful.
I'm looking for:
2024.11.25 21:56 Wild_Panda873 So Look What I Found On r/Silksong The Silksaga Continues...
submitted by Wild_Panda873 to ASilksong [link] [comments] |
2024.11.25 21:56 Yam3488-throwaway Is it typical for PMs to have a sales or marketing background?
I’
submitted by Yam3488-throwaway to ProductManagement [link] [comments]