โปรแกรม4
int led = 10;
void setup()
{
Serial.begin(9600);
pinMode(led,OUTPUT);
}
void loop()
{
int x,y;
x = analogRead(A0);
y = map(x,0,1023,0,255);
Serial.print("x = ");Serial.println(x);
Serial.print("y = ");Serial.println(y);
analogWrite(led,y);
}
void setup()
{
Serial.begin(9600);
pinMode(led,OUTPUT);
}
void loop()
{
int x,y;
x = analogRead(A0);
y = map(x,0,1023,0,255);
Serial.print("x = ");Serial.println(x);
Serial.print("y = ");Serial.println(y);
analogWrite(led,y);
}
ความคิดเห็น
แสดงความคิดเห็น