pleasedontcode

Bluetooth Data rev_04

Jul 11th, 2025
446
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /********* Pleasedontcode.com **********
  2.  
  3.     Pleasedontcode thanks you for automatic code generation! Enjoy your code!
  4.  
  5.     - Terms and Conditions:
  6.     You have a non-exclusive, revocable, worldwide, royalty-free license
  7.     for personal and commercial use. Attribution is optional; modifications
  8.     are allowed, but you're responsible for code maintenance. We're not
  9.     liable for any loss or damage. For full terms,
  10.     please visit pleasedontcode.com/termsandconditions.
  11.  
  12.     - Project: Bluetooth Data
  13.     - Source Code NOT compiled for: Arduino Mega
  14.     - Source Code created on: 2025-07-11 21:05:10
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* send data from bluetooth to android pc */
  21. /****** END SYSTEM REQUIREMENTS *****/
  22.  
  23. /* START CODE */
  24.  
  25. /****** DEFINITION OF LIBRARIES *****/
  26. #include <SoftwareSerial.h>
  27.  
  28. /****** FUNCTION PROTOTYPES *****/
  29. void setup(void);
  30. void loop(void);
  31. float T_interpolate(byte DS_Temp); // Added function prototype for T_interpolate
  32.  
  33. /***** DEFINITION OF Software Serial *****/
  34. const uint8_t hc05_HC05_mySerial_PIN_SERIAL_TX_A0 = A0;
  35. const uint8_t hc05_HC05_mySerial_PIN_SERIAL_RX_A1 = A1;
  36. SoftwareSerial hc05_HC05_mySerial(hc05_HC05_mySerial_PIN_SERIAL_RX_A1, hc05_HC05_mySerial_PIN_SERIAL_TX_A0);
  37.  
  38. void setup(void)
  39. {
  40.     // put your setup code here, to run once:
  41.     hc05_HC05_mySerial.begin(9600);
  42. }
  43.  
  44. void loop(void)
  45. {
  46.     // Check if data is available from Bluetooth
  47.     if (hc05_HC05_mySerial.available())
  48.     {
  49.         // Read data from Bluetooth
  50.         String receivedData = "";
  51.         while (hc05_HC05_mySerial.available())
  52.         {
  53.             char c = hc05_HC05_mySerial.read();
  54.             receivedData += c;
  55.         }
  56.         // Send the received data to the Android PC via Serial
  57.         Serial.println(receivedData);
  58.     }
  59. }
  60.  
  61. /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment