# Basic Digital and Analog I/O

## **Digital signal**&#x20;

&#x20;     เป็นสัญณาณที่มีลักษณะรูปคลื่นสัญญาณเป็น square waves ในด้านไมโครคอนโทรลเลอร์จะรับและส่งค่าสัญญาณประเภทดิจิตอลเป็นสองค่าคือ High และ Low  แปลงเป็นชุดข้อมูลที่เก็บเป็นตัวเลข 1 กับ 0 ซึ่งขนาดความยาวของการรับ-ส่งข้อมูลแต่ละชุดจะขึ้นอยู่กับประเภทของโปรโตคอลที่ใช้ในการสื่อสาร

![Digital Signals แหล่งที่มา: https://learn.sparkfun.com/tutorials/analog-vs-digital/digital-signals](/files/Du7YwUezAscgQYAHRjED)

## Analog signal&#x20;

&#x20;      เป็นสัญณาณที่มีลักษณะต่อเนื่องมีรูปคลื่นสัญญาณเป็น sine waves ในด้านไมโครคอนโทรลเลอร์จะรับและส่งค่าสัญญาณประเภทอนาล็อกมีค่าเป็นช่วงข้อมูลแปลงเป็นดิจิตอลแล้วเก็บเป็นชุดข้อมูลแบบบิตอีกครั้ง

![Analog Signal แหล่งที่มา: https://learn.sparkfun.com/tutorials/analog-vs-digital/analog-signals](/files/bNhNbqaVw2ot4KUPtucQ)

## Microcontroller input and output

Microcontroller (MCU) เป็นอุปกรณ์ควบคุมขนาดเล็กที่มี หน่วยประมวลผล (CPU) หน่วยความจำ(Memory) และสามารถรับ-ส่งข้อมูลกับอุปกรณ์อิเล็กทรอนิกส์ที่เชื่อมต่อกับบอร์ด MCU ผ่านพอร์ตรับข้อมูลเข้า(Input) และพอร์ตส่งข้อมูลออก(Output) ได้ สำหรับการเชื่อมต่ออุปกรณ์เพื่อจะรบส่งข้อมูลกับ MCU บอร์ดนั้น เราจะต้องรู้ก่อนว่าอุปกรณ์ที่ต้องการเชื่อมต่อเป็นประเภท Analog หรือ Digital และเราต้องการรับข้อมูลเข้ามา(Input)หรือส่งออก(Output) เพื่อที่จะสามารถเลือกพอร์ตในการเชื่อมต่อได้ถูกต้อง

**Arduino Uno R3 Board**

![    Arduino Uno R3 Board แหล่งที่มา : https://www.arduino.cc/en/Main/Products](/files/5xrNhMeb8BNlgGs85ywW)

**PINOUT of Arduinno Uno R3**

![Arduino Uno R3 แหล่งที่มา: https://store-usa.arduino.cc/products/arduino-uno-rev3](/files/gGhY1QO9bCerASjhgD9V)

## การเริ่มต้นใช้งาน Arduino Boards

สามารถใช้โปรแกรม Arduino IDE สำหรับ complie โปรแแกรมลงบอร์ด หรือทดลองเขียนโปรแกรมง่ายบน website จำลองได้ สำหรับเว็บไซต์จำลองมีข้อจำกัดด้านบอร์ดที่มีแค่ Arduino uno R3 ให้ทดลองเล่นได้ในตอนนี้

### [**ติดตั้งโปรแกรม Arduino IDE**](https://docs.aic-eec.com/embedded-systems/lab1-oscilloscope/arduino-ide)

### [**Website Arduino Simulator**](https://www.tinkercad.com/dashboard)

![](/files/a8G6fB0KEr8AsDz2DvM1)

###

&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aic-eec.com/embedded-systems/resources/basic-hardware-and-firmware/lab1-oscilloscope/basic-digital-and-analog-i-o.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
