|
arduino IDEArduino
|
ColorSenzor
Color senzor work with refleted color captured by LRD.
Pin Definitions:
sensorPin: Pin for the light sensor (A0).
LedRed, LedBlue, LedGreen: Digital pins for red, blue, and green LEDs (3, 4, 5).
read_value, value_red, value_blue, value_green: Variables for storing values reflected by different color LEDs.
k: Tolerance threshold.
Setup Function:
Sets all three LED pins as outputs (OUTPUT).
Turns off (sets to LOW) all LEDs.
Sets up serial communication at a baud rate of 9600.
Brief delay.
Loop Function:
Turns on (sets to HIGH) the red LED for 150 ms.
Reads the value from the light sensor.
Prints the values to the serial monitor and turns off (sets to LOW) the red LED.
Repeats the same steps for the green and blue LEDs.
Waits for 2 seconds before the next reading.
The purpose of this code is to compare the reflected values of red, green, and blue LEDs. The program detects differences in the sensor values within the tolerance range and displays them on the serial monitor. In practice, this code could be used, for example, in controlling a color sensor or an RGB LED, where the reflected values are observed when different colored lights are applied.
<a ref="https://www.youtube.com/watch?v=9gBgA_nF0z4">Youtube</a>
ColorSenzor
*PCBWay community is a sharing platform. We are not responsible for any design issues and parameter issues (board thickness, surface finish, etc.) you choose.
Raspberry Pi 5 7 Inch Touch Screen IPS 1024x600 HD LCD HDMI-compatible Display for RPI 4B 3B+ OPI 5 AIDA64 PC Secondary Screen(Without Speaker)
BUY NOW- Comments(0)
- Likes(0)
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by Istvan Sentes
-
A Compact Charging Breakout Board For Waveshare ESP32-C3
522 3 4 -
AI-driven LoRa & LLM-enabled Kiosk & Food Delivery System
511 2 0 -
-
-
-
ESP32-C3 BLE Keyboard - Battery Powered with USB-C Charging
716 0 1 -
-
mammoth-3D SLM Voron Toolhead – Manual Drill & Tap Edition
688 0 1 -
-
AEL-2011 Power Supply Module
1370 0 2 -
AEL-2011 50W Power Amplifier
1245 0 2







