Advertisement
pleasedontcode

Scanner rev_128

Nov 12th, 2023
66
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: Scanner
  13.     - Source Code compiled for: Arduino Uno
  14.     - Source Code created on: 2023-11-12 16:45:08
  15.     - Source Code generated by: AlexWind
  16.  
  17. ********* Pleasedontcode.com **********/
  18. /****** DEFINITION OF LIBRARIES *****/
  19. #include <Arduino.h>
  20. #include <SoftwareSerial.h>
  21.  
  22. /****** SYSTEM REQUIREMENT 1 *****/
  23. /* get hc05 signal and change PWM signal reducing */
  24. /* percentage if receiving DOWN data or increasing */
  25. /* percentage if receiving UP data. */
  26.  
  27. /****** FUNCTION PROTOTYPES *****/
  28. void setup(void);
  29. void loop(void);
  30.  
  31. /***** DEFINITION OF PWM OUTPUT PINS *****/
  32. const uint8_t activation_PIN_D3 = 3;
  33.  
  34. /***** DEFINITION OF Software Serial *****/
  35. const uint8_t bluetooth_HC05_mySerial_PIN_SERIAL_TX_A0 = A0;
  36. const uint8_t bluetooth_HC05_mySerial_PIN_SERIAL_RX_A1 = A1;
  37. SoftwareSerial bluetooth_HC05_mySerial(bluetooth_HC05_mySerial_PIN_SERIAL_RX_A1, bluetooth_HC05_mySerial_PIN_SERIAL_TX_A0);
  38.  
  39. void setup(void)
  40. {
  41.   // put your setup code here, to run once:
  42.   pinMode(activation_PIN_D3, OUTPUT);
  43.   bluetooth_HC05_mySerial.begin(9600);
  44. }
  45.  
  46. void loop(void)
  47. {
  48.   // put your main code here, to run repeatedly:
  49.   // Read data from HC05 module
  50.   if (bluetooth_HC05_mySerial.available()) {
  51.     char data = bluetooth_HC05_mySerial.read();
  52.     // Check if data is 'U' for UP or 'D' for DOWN
  53.     if (data == 'U') {
  54.       // Increase PWM signal percentage
  55.       // Add your code here
  56.     } else if (data == 'D') {
  57.       // Decrease PWM signal percentage
  58.       // Add your code here
  59.     }
  60.   }
  61. }
  62.  
  63. /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement