หน้าแรก ดูโปรเจกต์ทั้งหมด
Hard

โปรเจกต์ 4-Channel Photoresistor

ฉันมีโปรเจกต์ภาคการศึกษาและต้องการใช้ 4-channel photoresistor ในการควบคุม bi-directional motors จำนวนสองตัว

โปรเจกต์ 4-Channel Photoresistor

รายการอุปกรณ์และเครื่องมือ

1x Materia 101
-
1x Capacitor 1 µF
-
}

รายละเอียดและวิธีทำ

ผมได้ใช้หน้า RCtime จาก arduino.cc เพื่อให้ photoresistor แบบช่องเดียวทำงานได้และมี analog output ที่ค่อนข้างดี ตัว Cap มีค่า 1002nF และ Resistor มีค่า 1kohm

ผมทำให้โค้ดสำหรับ A0 ทำงานได้แล้ว ปัญหาคือตอนที่ผมเพิ่มช่องที่สอง ผมก๊อปปี้โค้ดและสร้างวงจรช่องที่สองเหมือนกันเป๊ะเลย

ปัญหาของผมคือการเพิ่มช่องที่สอง เมื่อผมทำให้โค้ดไม่มี error ได้แล้ว ตัว photo resistor ตัวที่สองกลับเปลี่ยนค่าของทั้งสองฝั่ง

หลังจากที่ผมแก้ปัญหานี้และทำให้วงจรไฟฟ้าทำงานได้แล้ว ผมจะต้องเปลี่ยนโค้ดเพื่อให้สั่งงาน motors

ผมรู้ว่าผมถามเยอะไปหน่อยในฟอรัม แต่พอจะมีเว็บไซต์หรือวิดีโอที่ผมสามารถเข้าไปดูและทำความเข้าใจเรื่องนี้ได้บ้างไหมครับ?

(โค้ด error ปัจจุบัน)

Arduino: 1.8.8 (Windows 10), Board: "Arduino/Genuino Uno"

C:\\*: In function 'long int RCtime(int)':

C:\\*:17:8: warning: unused variable 'result' [-Wunused-variable]

long result = 0;

^

C:\\*:24:1: warning: no return statement in function returning non-void [-Wreturn-type]

}

^

C:\\*: At global scope:

Semester_project_code:25:1: error: expected unqualified-id before '{' token

{

^

C:\\*: In function 'long int RCtime(int)':

Semester_project_code:30:6: error: redefinition of 'long int RCtime(int)'

long RCtime(int(trPin))

^

C:\\*:15:6: note: 'long int RCtime(int)' previously defined here

long RCtime(int tlPin)

^

Semester_project_code:39:1: error: expected primary-expression before '}' token

}

^

C:\\*:32:8: warning: unused variable 'result' [-Wunused-variable]

long result = 0;

^

C:\\*:39:1: warning: no return statement in function returning non-void [-Wreturn-type]

}

^

exit status 1

expected unqualified-id before '{' token

This report would have more information with

"Show verbose output during compilation"

option enabled in File -> Preferences.

Code

🔒 ปลดล็อก Code

สนับสนุนเพื่อรับ Source Code หรือแอปพลิเคชันสำหรับโปรเจกต์นี้

รหัสอ้างอิงโปรเจกต์: 4-channel-photoresistor-3d3694
435 บาท
PromptPay QR Code