Controlling the brightness of the LED light can be achieved by adjusting the voltage, but it is not ideal, and the adjustable range is small, the voltage is slightly higher, and the LED is easily burned. The only feasible method is to control by PWM (pulse width adjustment). Its brightness.
The following program is to control the LED in the microcontroller. .
//***********************
// PWM control LED brightness
// Author: Yong
//***********************
#include
Sbit speaker=P2^1;//Define the speaker control pin
Sbit up=P1^5; //Define the UP key
Sbit down=P1^6; //Define the DOWN key
staTIc unsigned char pwm;
Unsigned char t;
Main ()
{
Void delay (unsigned char ms);
Void beep (void);
Void alarm_delay (void);
TMOD=0X21;
ET0=1;
ET1=1;
EA=1;
TH0=0XFC; //Timer 0, timing 1ms
TL0=0X18;
TH1=0X9C; //Timer 1, timing 0.1ms
TL1=0X00;
TR0=1;
PT1=1; //Define timer 1 priority interrupt
Pwm=0x9c;
While (1)
{
Do
{
Pwm++;
Delay (10);
If (pwm==0xff) beep();
}
While (pwm!=0xff);
Do
{
Pwm--;
Delay (10);
If (pwm==0x01) beep ();
}
While (pwm!=0x01);
}
}
Void TImer0 (void) interrupt 1 //Define timer 0
{
TH0=0XFC;
TL0=0X18;
TR1=1;
TH1=pwm;
P0=0X00;
}
Void TImer1(void) interrupt 3 //Define timer 1
{
P0=0XFF;
TR1=0;
}
Void delay (unsigned char ms)//delay
{
Unsigned char i=120;
While (ms--)
{
While (i--)
{}
}
}
Void beep (void)//alarm
{
Unsigned char b;
For (b=40;b)=2;b--)
{speaker=! Speaker;
Alarm_delay ();
}
Speaker=1;
}
Void alarm_delay (void) //Alarm delay
{
Unsigned char TIme;
For (time=0;time"120;time++)
{}
}
A high-speed slip ring is an electromechanical device that allows electrical current to pass between a stationary and a rotating assembly. It is typically used in applications where the speed requirement exceeds that which is achievable with a standard slip ring. High-speed slip rings are available in a variety of sizes and configurations to meet the needs of most applications. They are commonly used in military, aerospace, and medical applications where speed and reliability are critical.
The speed is required to be at least tens of thousands of revolutions per minute, the structure of the Conductive Slip Ring directly determines the contact of high speed, as well as the size of impedance. High-speed slip ring materials have high wear resistance, high life characteristics, and multi-contact contact can ensure signal transmission and power reliability, with the development of science and technology, high-speed slip rings will be more and more widely used.
If you need to transfer large amounts of data or power between two stationary objects, a high-speed conductive slip ring is what you need. Traditional slip rings only offer a few thousand revolutions per minute (RPM), which is more than enough for most applications, but can be limiting in some circumstances. Some applications, like those found in the medical or military field, require speeds of tens of thousands of RPM in order to function properly. That's where our high-speed conductive slip ring comes in. With speeds up to a certain range, it can handle even the most demanding applications.
High Speed Slip Ring,Rotary Slip Ring Electrical,Slip Electrical Connector,Hydraulic Rotary Joint
Dongguan Oubaibo Technology Co., Ltd. , https://www.sliprobs.com