งานที่4


Code

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);
}

ความคิดเห็น

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

DIY Arduino Traffic Light Pedestrian Light Push Button Control (https://thecustomizewindows.com/2016/06/diy-arduino-traffic-light-pae-push-button/)

ไมโครคอนเทอร์เลอร์(อ้างอิงhttp://www.techmonkeybusiness.com/ps2-controller-sketch-for-escs-and-stuff.html)

Arduino Bluetooth Control Smart Home (http://androidcontrol.blogspot.com/2015/05/arduino-bluetooth-control-smart-home.html?m=1)