https://www.tinkercad.com/things/l9xn9m2uZIk-funky-esboo/editel?sharecode=oOr8kZk9Lzrq4e2iDkZwGMtkXKs0yEq9y6xsO1qb-Vo
const int pinLed1=3;
const int pinLed2=6;
const int pinLed3=5;
const int pinPotenciometrLed1=A0;
const int pinPotenciometrLed2=A1;
const int pinPotenciometrLed3=A2;
int valorLed1;
int valorLed2;
int valorLed3;
int led1;
int led2;
int led3;
void setup(){
pinMode(pinLed1,OUTPUT);
pinMode(pinLed2,OUTPUT);
pinMode(pinLed3,OUTPUT);
}
void loop(){
valorLed1=analogRead(pinPotenciometrLed1);
valorLed2=analogRead(pinPotenciometrLed2);
valorLed3=analogRead(pinPotenciometrLed3);
led1=map(valorLed1,0,1023,0,255);
led2=map(valorLed2,0,1023,0,255);
led3=map(valorLed3,0,1023,0,255);
analogWrite(pinLed1,led1);
analogWrite(pinLed2,led2);
analogWrite(pinLed3,led3);
delay(100);
}
2. 1 razryad 7 segmentli indikator yordamida jarayonlarni boshqarish.
https://www.tinkercad.com/things/eJVj00YjZN4-cool-jaiks/editel?sharecode=wBAuuTOFvcc0PVwa53w-LcHNrFf5VwHoF_kDP3ypiY4
3. 4 razryadli 7 segmentli indikator yordamida jarayonlarni boshqarish.
https://www.tinkercad.com/things/lzXeBLR8jDd-swanky-jaagub/editel?sharecode=ROf6kR4HmciwhU_MIxxao6lyX1I_IUO9mAWrlalfdrk
char a=2;
char b=3;
char c=4;
char d=5;
char e=6;
char f=7;
char g=8;
char digit1 = 13;
char digit2 = 12;
char digit3 = 11;
char digit4 = 10;
char Number[10] ={
0b1111110, // 0
0b0110000, // 1
0b1101101, // 2
0b1111001, // 3
0b0110011, // 4
0b1011011, // 5
0b1011111, // 6
0b1110000, // 7
0b1111111, // 8
0b1111011, // 9
};
void display(int n)
{
digitalWrite(a, (Number[n] & 0b1000000));
digitalWrite(b, (Number[n] & 0b0100000));
digitalWrite(c, (Number[n] & 0b0010000));
digitalWrite(d, (Number[n] & 0b0001000));
digitalWrite(e, (Number[n] & 0b0000100));
digitalWrite(f, (Number[n] & 0b0000010));
digitalWrite(g, (Number[n] & 0b0000001));
}
void offdisplay()
{
digitalWrite(digit1, 1);
digitalWrite(digit2, 1);
digitalWrite(digit3, 1);
digitalWrite(digit4, 1);
}
void setup()
{
pinMode(a, OUTPUT);
pinMode(b, OUTPUT);
pinMode(c, OUTPUT);
pinMode(d, OUTPUT);
pinMode(e, OUTPUT);
pinMode(f, OUTPUT);
pinMode(g, OUTPUT);
pinMode(digit1, OUTPUT);
pinMode(digit2, OUTPUT);
pinMode(digit3, OUTPUT);
pinMode(digit4, OUTPUT);
}
long count = 0;
void loop()
{
count = millis() / 100;
char n1 = (count % 10000) / 1000;
char n2 = (count % 1000) / 100;
char n3 = (count % 100) / 10;
char n4 = count % 10;
display(n1);
digitalWrite(digit1, 0);
delay(1);
offdisplay();
display(n2);
digitalWrite(digit2, 0);
delay(1);
offdisplay();
display(n3);
digitalWrite(digit3, 0);
delay(1);
offdisplay();
display(n4);
digitalWrite(digit4, 0);
delay(1);
offdisplay();
}
Xulosa
Biz 2-amaliy ishda RGB led, 1 razryad 7 segmentli indicator va 4 razryad 7 segmentli indikatorlar haqida toliq axborotga ega boldik, va ular qayerlarda ishlatilishin hozirgi kunda ularga etibor kattaligin bildik. Ularni Tinkercad dasturi orqali blok shemasin va qanaqa kodlar orqali ulanishin bilib oldik.
Do'stlaringiz bilan baham: |