Arduino Uno how to use the LCD button to adjust the PWM output?

Arduino Uno how to use the LCD button to adjust the PWM output?

From the picture, I’m guessing your LCD has a touchscreen of some sort.

You first need to figure out what interface you are going to use, then it should get easier.

Do your research, and come back with a complete data sheet & comms protocol for your touch screen, then we might be able to push you n the right direction.

this is your 11th topic. It is about time to do those steps:
You are welcome on this forum! You are working on an informatic project and what is most needed in an informatic project is information imagine: do the other users here in the forum have a clear picture of what you are trying to do?

To speed up finishing your project you should invest some time into writing additional information I'm 100% sure that this WILL speed up finishing your project.

So please go through this checklist and if you find an item you haven't posted yet post it

  • did you write which exact type of microcontroller you are using?
  • description of your programming skills and knowledge
  • description of your knowledge about electronics
  • description of the functionality you want to have written in normal works avoiding programming terms
  • do you have an oscilloscope? Yes / No
  • do you have a digital multimeter (DMM) Yes / No)
  • your age
  • did you post your complete sketch?
  • if relevant did you post a link to a datasheet of each component you are using?
  • if relevant did you post a handdrawn schematic or your wiring?
  • if you got a compiler-error. Did you post the complete compiler-output into a code-section?

If you don't post all this information because you want a "quick answer" to your detail problem It is very likely to turn out that all that happens is having mutliple waiting-times with mutliple asking back for details until the other users do have a clear picture of what you want to do.

best regards Stefan (somehow the picture I get from you is: dftt)

I am indeed using a touchscreen display, which I connected to the Arduino through the serial port.
Here is the datasheet.

https://www.stoneitech.com/media/upload/Download/Data%20sheet/Datasheet%20STVA101WT-01.pdf

  • I am using Arduino UNO and have some external devices such as LEDs and motors.
  • I want to control the brightness of the LED and the speed of the fan by using the buttons "+" or "-" on the touch screen.
  • I learned the use of fritzing in order to draw connection diagrams.
  • I have attached a link to the datasheet about the product on the 4th floor.
  • I will attach my code here, I wrote part of it but it doesn't implement the PWM function.
uint8_t rxspeed[8] = {0xA5, 0x5A, 0x06, 0x82, 0x00, 0x01, 0x00, 0x00};
uint8_t rxdose[8] = {0xA5, 0x5A, 0x06, 0x82, 0x00, 0x02, 0x00, 0x00};
uint8_t rxrf[8] = {0xA5, 0x5A, 0x06, 0x82, 0x00, 0x03, 0x00, 0x00};
uint8_t aa;
uint8_t Recieved[40];

uint32_t PWM_DUTY=20;//占空比

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  pinMode(3, OUTPUT);
  pinMode(9, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
if(Serial.available() != 0)
  {
    for(aa = 0; aa < 8; aa ++)
    {
        Recieved[aa] = Serial.read();
    } 
    switch(Recieved[4])
    {
      case 0x01://speed
      rxspeed[7] = Recieved[7];
      Serial.write(rxspeed, 8);
      break;
      case 0x02://dose
      rxdose[7] = Recieved[7];
      Serial.write(rxdose, 8);
      break;
      case 0x03://rf
      rxrf[7] = Recieved[7];
      Serial.write(rxrf, 8);
      break;
      default:
      break;
    }
  }
    analogWrite(3,rxspeed[7]);
    analogWrite(9,rxdose[7]);
  }

Hi vincomgo,

you should use constants and variablenames consequently for everything. This will make your code much eaiser to read and to maintain.

You seem to expect that your potential helpers are studying the datasheet of your special touchscreen.

You are the one that wants help. So make it easy for others to help you.
You should do a try on your own by reading the datasheet of your touchscreen and post your best attempt how the plus/minus-buttons on your touch-screen could

and additonally writing an abstract how your special touch-screen works and pointing to the right pages in the datasheet.

best regards Stefan

You can’t POWER the servo from the Arduino…
The display might be a problem too.

A good start would be to draw out a schematic/circuit diagram… Fritzing diagrams are no use to anyone with skills & experience.

I've been reading a lot of examples on how to use PWM recently, and of course, I've read the simple examples given on the Arduino website. I will try to see how to control the LED. if my wiring diagram is ok then maybe the program is not written correctly.

It's not the servo I'm using, it's the motor. I'm not very skilled with fritzing and may have the wrong parts.

You still can’t power a dc motor from the Arduino..

to emphasise what lastchancename said and to add numbers.

Any device with low-current-control-inputs and its own power-supply (Vcc)-Pin that goes above a current-consumption of 50 mA should be supplied by an additional power-supply. The GND of the additional power-supply must be connected to GND of the microcontroller.

Any device without an extra power-supply-Pin (like LEDs, DC-motors, buzzers, etc.) with a current-consumption that goes above 5 mA must be switched on/off by an additional power-switching device.
Such devices can not be supplied from an IO-Pin directly.
Yes even an LED is critical to drive directly from an IO-pin. You have to take care of a well adapted current limiting resistor.

Such power-switching devices can be

  • small transistor for currents from 10 mA to 100 mA

  • bigger transistor for currents from 10 mA to 1 A

  • MOS-FET-transistor with TTL-voltage-Level Gate max current rated 2 times higher of maximum occuring current

  • relay-modules

For devices that have a coil like relay, electromagnets or motors freewheeling diodes are needed additionally.

best regards Stefan