บทความ

กำลังแสดงโพสต์ที่มีป้ายกำกับ ชลิตา

ESP32 KeyPad

 .. ชลิตา จูมสีมา : เขียน Library: https://github.com/Chris--A/Keypad ตัวอย่างโค้ด:  #include <Keypad.h> const byte ROWS = 4; //four rows const byte COLS = 4; //three columns char keys[ROWS][COLS] = { {'1','2','3','A'}, {'4','5','6','B'}, {'7','8','9','C'}, {'*','0','#','D'} }; byte rowPins[ROWS] = {13, 12, 14, 27}; //connect to the row pinouts of the keypad byte colPins[COLS] = {26, 25, 33, 32}; //connect to the column pinouts of the keypad Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS ); void setup(){ Serial.begin(115200); } void loop(){ char key = keypad.getKey(); if (key){ Serial.print(key); } } ..

การใช้ KidBright RTC Module ใน Arduino IDE

รูปภาพ
 .. Step 1. โหลด RTC Lib แล้วติดตั้ง (บอร์ด kidbright ใช้ rtc chip เบอร์ : MCP79412RTC) https://github.com/ichilton/mcp7941x_arduino    >>  แนะนำจากเอกสาร nectec แต่ตัวนี้อ่านค่าขึ้นมาไม่ได้เลย https://github.com/JChristensen/MCP79412RTC   >>  Lib นี้ อ่านค่าได้ แต่บันทึกแล้วไม่จำ, sync ไม่ติด https://github.com/stevemarple/RTCx  >> ทดลองแล้ว ใช้งานได้จริงกับบอร์ด kidbright Step 2. โหลด TimeLib แล้วติดตั้ง (ไม่จำเป็น) https://github.com/PaulStoffregen/Time Step 3. รันโค้ดตัวอย่างใน RTC Lib; เมื่อคอมไพล์เสจ็จ เปิดดูผลลัพธ์ได้จาก Serial Monitor จะพบผลลัพธ์ดังภาพ ...

ติดตั้งบอร์ด ESP32 ใน Arduino IDE v2

รูปภาพ
 .. ชลิตา จูมสีมา : เขียน/เรียบเรียง Step 1. ที่โปรแกรม IDE เลือก file > Preference Step 2. ที่ Additional boards manager URL เพิ่ม (1 บรรทัดต่อ 1 Link กรณีติดตั้งบอร์ดอื่นๆด้วย เช่น บอร์ด microbit, sparkfun, ...) https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json Step 3. คลิกที่ Boards Manager แล้วพิมพ์คำว่า esp32 ในช่องค้นหา เลือก esp32 by Espressif Systems แล้วทำการติดตั้ง (ต้องเชื่อมต่อ Internet) Step 4. เลือกบอร์ดโดยคลิกที่ Select other board and port...  Step 5. ที่ช่องค้นหา พิมพ์หาชื่อบอร์ดที่ต้องการ จากนั้นเลือกรุ่นบอร์ดและ port ที่เชื่อมต่อกับบอร์ด ESP32 Step 6. ทดลองเขียนโค้ดดังนี้ แล้วคลิปปุ่ม upload (เมื่อขึ้น uploading ต้องกดปุ่ม boot บนตัวบอร์ด)  void setup() { Serial.begin(9600); Serial.println("Hi, It's working"); } void loop() { } Step 7. เมื่อ upload แล้ว ให้เปิดหน้าต่าง Serial Monitor จากนั้นปรับ baud rate ไปที่ 9600 แล้วกดปุ่ม Reset ที่ตัวบอร์ดเพื่อดูผลลัพธ์ ..