Skip to content

Instantly share code, notes, and snippets.

@penpencool
Created June 12, 2018 09:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save penpencool/a23adf3334031cae07885b0a70d17a7e to your computer and use it in GitHub Desktop.
Save penpencool/a23adf3334031cae07885b0a70d17a7e to your computer and use it in GitHub Desktop.
// Example By ArduinoAll
int ledPin = 13; // ต่อ LED กับขา 13
int inPin = 7; // ต่อกับเซนเซอร์สาย OUTPUT/สีดำ
int val = 0;
void setup()
{
pinMode(ledPin, OUTPUT);
pinMode(inPin, INPUT);
}
void loop()
{
val = digitalRead(inPin); // อ่านค่าจากเซนเซอร์
digitalWrite(ledPin, val); // แสดงค่าออก LED
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment