ماژول چشمک زن LED 7 رنگ KY-034
- پارت نامبر KY-034
- سازنده آردوینو
- نوع محصولProduct Type LED
- شکلShape Round LED 5mm DIP type
- رنگColor pink yellow green (high brightness)
- ولتاژ پیشینForward Voltage 3.0-4 .5 V
- نوع لنزLens Type White mist
- وزنWeight 20 g
ماژول چشمک زن LED
ماژول ky-034 یک ماژول چشمک زن LED است که اگر ماژول از طریق منبع تغذیه وصل شود، یک چراغ روشن می شود که به طور خودکار رنگ آن را تغییر می دهد و شامل 7 رنگ مختلف است.
مشخصات فنی ماژول
ماژول چشمک زن LED 7 رنگ از دیود تابشی با وضوح بالا 5 میلی متر استفاده می کند که دارای مشخصات زیر است:
مشخصات ماژول در جدول زیر آمده است:
پایه های ماژول چشمک زن
اتصال پایه های ماژول در برد Arduino و Raspberry Pi در جدول های زیر آورده شده است:
دیاگرام اتصالات ماژول چشمک زن LED
پایه های مختلف ماژول را مطابق جدول بالا و به صورت آنچه در تصویر زیر مشاهده میشود به برد آردوینو متصل کنید.
کدهای آردوینو برای ماژول چشمک زن LED 7 رنگ
کد آردوینو زیر نشان می دهد که چگونه می توانید یک LED را به مدت 4 ثانیه و بیش از 2 ثانیه از طریق پین خروجی روشن کنید.
<pre class="EnlighterJSRAW" data-enlighter-language="c">int Led = 13;
void setup ()
{
pinMode (Led, OUTPUT); // Initialization of the LED output pin
}
void loop () // main program loop
{
digitalWrite (Led, HIGH); // LED will be switched on
delay (4000); // waitmode for 4 seconds
digitalWrite (Led, LOW); // LED will be switched off
delay (2000); // waitmode for another 2 seconds
}
</pre>
کدهای Raspberry Pi
<pre class="EnlighterJSRAW" data-enlighter-language="c"># Needed modules will be imported and configured
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
# Declaration of the input pin which is connected with the sensor.
# Additional to that the pull up resistor from the input will be activated.
LED_PIN = 24
GPIO.setup(LED_PIN, GPIO.OUT, initial= GPIO.LOW)
print "LED-Test [press ctrl+c to end]"
# main program loop
try:
while True:
print("LED is on for 4 seconds")
GPIO.output(LED_PIN,GPIO.HIGH) #LED will be switched on
time.sleep(4) # Waitmode for 4 seconds
print("LED is off for 2 Sekunden")
GPIO.output(LED_PIN,GPIO.LOW) #LED will be switched off
time.sleep(2) # Waitmode for another 2 seconds
# Scavenging work after the end of the program
except KeyboardInterrupt:
GPIO.cleanup()</pre>