งานที 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);

}

ความคิดเห็น

โพสต์ยอดนิยมจากบล็อกนี้

https://www.9arduino.com/article/71/โปรเจคเครื่องรดน้ำต้นไม้อัตโนมัติ-ด้วย-arduino-ราคาถูก-พร้อม-code-ตัวอย่าง

https://www.arduitronics.com/article/22/arduino-and-motor-control-part-1

http://www.myarduino.net/article/6/%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%80%E0%B8%82%E0%B8%B5%E0%B8%A2%E0%B8%99%E0%B9%82%E0%B8%9B%E0%B8%A3%E0%B9%81%E0%B8%81%E0%B8%A3%E0%B8%A1%E0%B9%80%E0%B8%9A%E0%B8%B7%E0%B9%89%E0%B8%AD%E0%B8%87%E0%B8%95%E0%B9%89%E0%B8%99%E0%B8%81%E0%B8%B1%E0%B8%9A-arduino-c-%E0%B9%84%E0%B8%9F%E0%B8%A7%E0%B8%B4%E0%B9%88%E0%B8%87