0Pricing
Arduino & IoT Academy · บทเรียน

สัญญาณดิจิทัลเทียบกับแอนะล็อก

ความแตกต่างระหว่างเปิด/ปิดกับช่วงค่าที่ต่อเนื่อง

สัญญาณดิจิทัลเทียบกับแอนะล็อก เป็นบทเรียน Arduino & IoT Academy ฟรีบน CoddyKit นี่คือบทเรียนที่ 1 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Arduino & IoT Academy และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Arduino & IoT Academy มีบทเรียนทั้งหมด 4 บทเรียน

บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ

Two Kinds of Signal

Electronics speak in two languages. A digital signal is simple on or off, while an analog one varies smoothly. Both matter in your projects.

Digital Means On or Off

A digital signal has only two states: HIGH or LOW, like a light switch. There is nothing in between, just yes or no.

Analog Means a Range

An analog signal can be any value across a range, like a dimmer slowly fading a lamp from off to full brightness.

The Real World Is Analog

Temperature, light, and sound never jump between two values. They flow smoothly, so the real world is mostly analog by nature.

Voltage Carries the Value

On an Arduino, an analog reading is really a voltage between 0V and 5V. A higher voltage simply means a higher value.

A Button Is Digital

A push button is the perfect digital input. It is either pressed or not, so you read it as HIGH or LOW with digitalRead.

A Knob Is Analog

A turning potentiometer sends a smoothly changing voltage. Turn it slowly and the value glides, so you read it as analog.

Different Pins for Each

The Uno keeps them separate. Digital pins are labeled D0 to D13, while the analog input pins are labeled A0 to A5.

Two Functions to Read

You match the function to the signal: digitalRead for on or off pins, and analogRead for the smooth analog inputs.

int btn = digitalRead(2);
int knob = analogRead(A0);

Analog Gets Digitized

Your chip cannot truly feel a smooth voltage. An ADC converts that analog voltage into a number the code can use.

Why the Difference Matters

Choosing the right type avoids bugs. Read a sensor with analogRead and a switch with digitalRead, and your data stays correct.

Quick Check

Which input belongs to the analog world?

Recap: Digital vs Analog

You learned that digital is on or off while analog is a smooth range. Buttons are digital, knobs are analog. Match the read function to each.

คำถามที่พบบ่อย

บทเรียน “สัญญาณดิจิทัลเทียบกับแอนะล็อก” ฟรีหรือไม่

ใช่ — ข้อความเต็มของ “สัญญาณดิจิทัลเทียบกับแอนะล็อก” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Arduino & IoT Academy ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Arduino & IoT Academy มีบทเรียนทั้งหมด 4 บทเรียน

คุณจะเรียนรู้อะไรในบทเรียน “สัญญาณดิจิทัลเทียบกับแอนะล็อก”

ความแตกต่างระหว่างเปิด/ปิดกับช่วงค่าที่ต่อเนื่อง คุณปฏิบัติ Arduino & IoT Academy ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน

คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Arduino & IoT Academy หรือไม่

ไม่จำเป็นต้องมีประสบการณ์มาก่อน Arduino & IoT Academy บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 1 จากทั้งหมด 4 บทเรียน

บทเรียน “สัญญาณดิจิทัลเทียบกับแอนะล็อก” ใช้เวลานานแค่ไหน

บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย

ฉันเขียนและรันโค้ดในบทเรียน Arduino & IoT Academy นี้ได้ไหม

ได้ บทเรียน Arduino & IoT Academy ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ

บทเรียนทั้งหมดในหลักสูตรนี้

  1. สัญญาณดิจิทัลเทียบกับแอนะล็อก
  2. analogRead คืนค่า 0–1023
  3. อ่านปุ่มหมุนโพเทนชิโอมิเตอร์
  4. map() ค่าไปยังช่วงใหม่
← กลับไปที่ Arduino & IoT Academy