|
Serial.println(sensorReading)
|
səhifə | 4/4 | tarix | 04.05.2023 | ölçüsü | 1,06 Mb. | | #107633 |
| 7-8-9 Tursunaliyev UmarjonBu səhifədəki naviqasiya:
- Serial
Serial.println(sensorReading);
delay(1);
int potPin = A5;
int led1Pin = 2;
int led2Pin = 3;
int led3Pin = 4;
int led4Pin = 5;
void setup()
{
pinMode(potPin,INPUT);
pinMode(led1Pin,OUTPUT);
pinMode(led2Pin,OUTPUT);
pinMode(led3Pin,OUTPUT);
pinMode(led4Pin,OUTPUT);
Serial.begin(9600);
}
void loop()
{
int potMeasure = analogRead(A5);
Serial.println(potMeasure);
if(potMeasure<256)
{
digitalWrite(led1Pin, HIGH);
digitalWrite(led2Pin, LOW);
digitalWrite(led3Pin, LOW);
digitalWrite(led4Pin, LOW);
}
else if( potMeasure < 512)
{
digitalWrite(led1Pin, HIGH);
digitalWrite(led2Pin, HIGH);
digitalWrite(led3Pin, LOW);
digitalWrite(led4Pin, LOW);
}
else if( potMeasure < 768)
{
digitalWrite(led1Pin, HIGH);
digitalWrite(led2Pin, HIGH);
digitalWrite(led3Pin, HIGH);
digitalWrite(led4Pin, LOW);
}
else if( potMeasure < 1024)
{
digitalWrite(led1Pin, HIGH);
digitalWrite(led2Pin, HIGH);
digitalWrite(led3Pin, HIGH);
digitalWrite(led4Pin, HIGH);
}
}
Dostları ilə paylaş: |
|
|