Skip to content

Instantly share code, notes, and snippets.

@penpencool
Created June 12, 2018 09:53
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/e78446e5fc723a7f9c89e9804091c795 to your computer and use it in GitHub Desktop.
Save penpencool/e78446e5fc723a7f9c89e9804091c795 to your computer and use it in GitHub Desktop.
/* Example By ArduinoAll
www.arduinoall.com
5V - 5V
Gnd - Gnd
Output - A0
*/
void setup() {
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(A0); // อ่านค่าจากเซนเซอร์ แบบ Analog
Serial.println(sensorValue); // แสดงค่าความเอียง/สั่น ที่อ่านได้
delay(1000); // หน่วงเวลาสำหรับอ่านครั้งต่อไป
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment