Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********* Pleasedontcode.com **********
- Pleasedontcode thanks you for automatic code generation! Enjoy your code!
- - Terms and Conditions:
- You have a non-exclusive, revocable, worldwide, royalty-free license
- for personal and commercial use. Attribution is optional; modifications
- are allowed, but you're responsible for code maintenance. We're not
- liable for any loss or damage. For full terms,
- please visit pleasedontcode.com/termsandconditions.
- - Project: Scanner
- - Source Code compiled for: Arduino Uno
- - Source Code created on: 2023-11-12 17:06:49
- - Source Code generated by: AlexWind
- ********* Pleasedontcode.com **********/
- /********* User code review feedback **********
- #### Feedback 1 ####
- - complete the code
- ********* User code review feedback **********/
- /****** DEFINITION OF LIBRARIES *****/
- #include <Arduino.h>
- #include <SoftwareSerial.h>
- /****** SYSTEM REQUIREMENT 1 *****/
- /* get hc05 signal and change PWM signal reducing */
- /* percentage if receiving DOWN data or increasing */
- /* percentage if receiving UP data. */
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- /***** DEFINITION OF PWM OUTPUT PINS *****/
- const uint8_t activation_PIN_D3 = 3;
- /***** DEFINITION OF Software Serial *****/
- const uint8_t bluetooth_HC05_mySerial_PIN_SERIAL_TX_A0 = A0;
- const uint8_t bluetooth_HC05_mySerial_PIN_SERIAL_RX_A1 = A1;
- SoftwareSerial bluetooth_HC05_mySerial(bluetooth_HC05_mySerial_PIN_SERIAL_RX_A1, bluetooth_HC05_mySerial_PIN_SERIAL_TX_A0);
- void setup(void)
- {
- // put your setup code here, to run once:
- pinMode(activation_PIN_D3, OUTPUT);
- bluetooth_HC05_mySerial.begin(9600);
- }
- void loop(void)
- {
- // put your main code here, to run repeatedly:
- // Read data from HC05 module
- if (bluetooth_HC05_mySerial.available()) {
- char data = bluetooth_HC05_mySerial.read();
- // Check if data is 'U' for UP or 'D' for DOWN
- if (data == 'U') {
- // Increase PWM signal percentage
- // Add your code here
- analogWrite(activation_PIN_D3, 200); // Example: Set PWM signal to 80% duty cycle
- } else if (data == 'D') {
- // Decrease PWM signal percentage
- // Add your code here
- analogWrite(activation_PIN_D3, 100); // Example: Set PWM signal to 40% duty cycle
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement