|
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 shared platform and we are not responsible for any design issues.
- 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
-
-
Open Source Very Large Stick - Freejoy & MMjoy2 breakout board
539 0 0 -
RF Control training board for students based on ESP32 C3
729 0 2 -
Aquarius+ Computer, Standard PCB
968 0 5 -
KINETIC COASTERS with a TWIST! Laser or 3D Print some DIY Magic
634 0 1 -
RPI - 8 IO PLC With ATTiny85 Watch Dog
551 0 1 -
Nintendo Famicom HVC-001 Controller Shells
654 0 1 -
COMMODORE 128 DIAGNOSTIC REV.785260 KEYBOARD DONGLE
608 0 4 -
COMMODORE 128 15KHz DISPLAY ADAPTER (C128 80 COLUMN ADAPTER)
835 1 7