KS0310 Keyestudio Traffic Light Module (Black and Eco-friendly): Difference between revisions

From Keyestudio Wiki
Jump to navigation Jump to search
No edit summary
Line 2: Line 2:
== Keyestudio Traffic Light Module (Black and Eco-friendly) ==
== Keyestudio Traffic Light Module (Black and Eco-friendly) ==
<br>[[File:Ks0310 traffic light module.png|500px|frameless|thumb]]<br>
<br>[[File:Ks0310 traffic light module.png|500px|frameless|thumb]]<br>


== Introduction ==
== Introduction ==
Line 7: Line 8:
Convenient for wiring, we specially design this traffic light module. On the module, it has integrated three LEDs, like LED-R, LED-Y, LED-G.   
Convenient for wiring, we specially design this traffic light module. On the module, it has integrated three LEDs, like LED-R, LED-Y, LED-G.   
This module is able to make some light-interactive works, fully compatible with Arduino microcontroller and raspberry pi system.
This module is able to make some light-interactive works, fully compatible with Arduino microcontroller and raspberry pi system.


== Specification ==
== Specification ==
Line 12: Line 14:
* Interface Type: Digital
* Interface Type: Digital
* PH2.54 Socket
* PH2.54 Socket


== Connection Diagram ==
== Connection Diagram ==
Line 18: Line 21:
Connect the traffic light module to UNO board, R pin to Digital 5, Y pin to Digital 4, G pin to Digital 3, GND to GND.
Connect the traffic light module to UNO board, R pin to Digital 5, Y pin to Digital 4, G pin to Digital 3, GND to GND.
<br>[[File:Ks0310-2.png|500px|frameless|thumb]]<br>
<br>[[File:Ks0310-2.png|500px|frameless|thumb]]<br>


== Sample Code ==
== Sample Code ==
Line 50: Line 54:
}
}
</pre>
</pre>


== Test Result ==
== Test Result ==
Done uploading the code, powered up, three LEDs on the module will automatically simulate the traffic light running.
Done uploading the code, powered up, three LEDs on the module will automatically simulate the traffic light running.
<br>[[File:KS0311图片1.png|500px|frameless|thumb]]<br>
<br>[[File:KS0311图片1.png|500px|frameless|thumb]]<br>


For further study, you can connect it to your PI. An example as below figure shown.
For further study, you can connect it to your PI. An example as below figure shown.
<br>[[File:KS0310 (3).jpg|500px|frameless|thumb]]<br>
<br>[[File:KS0310 (3).jpg|500px|frameless|thumb]]<br>


== Resources ==
== Resources ==
Line 62: Line 69:
'''Datasheet:'''<br>
'''Datasheet:'''<br>
https://drive.google.com/open?id=1kRW1oUF6lrusVFcy-ABDWWKl-R7K1uZC
https://drive.google.com/open?id=1kRW1oUF6lrusVFcy-ABDWWKl-R7K1uZC


== Buy From ==
== Buy From ==

Revision as of 13:19, 9 July 2018

Keyestudio Traffic Light Module (Black and Eco-friendly)


thumb


Introduction

When learning the microcontroller, you may usually use three separate LEDs, namely red, green and yellow light, to simulate the traffic light blinking via external connection.
Convenient for wiring, we specially design this traffic light module. On the module, it has integrated three LEDs, like LED-R, LED-Y, LED-G. This module is able to make some light-interactive works, fully compatible with Arduino microcontroller and raspberry pi system.


Specification

  • Working Voltage: 3.3-5v
  • Interface Type: Digital
  • PH2.54 Socket


Connection Diagram

Here’s a wiring diagram combining the traffic light module, four jumper wires and keyestudio UNO board

Connect the traffic light module to UNO board, R pin to Digital 5, Y pin to Digital 4, G pin to Digital 3, GND to GND.
thumb


Sample Code

Here is a simple Arduino example based on the circuit above. Copy and paste this into your Arduino IDE , then upload!

int redled =5; // initialize digital pin 5.
int yellowled =4; // initialize digital pin 4.
int greenled =3; // initialize digital pin 3.
void setup()
{
pinMode(redled, OUTPUT);// set the pin with red LED as “output”
pinMode(yellowled, OUTPUT); // set the pin with yellow LED as “output”
pinMode(greenled, OUTPUT); // set the pin with green LED as “output”
}
void loop()
{
digitalWrite(greenled, HIGH);//// turn on green LED
delay(5000);// wait 5 seconds
digitalWrite(greenled, LOW); // turn off green LED
for(int i=0;i<3;i++)// blinks for 3 times
{
delay(500);// wait 0.5 seconds
digitalWrite(yellowled, HIGH);// turn on yellow LED
delay(500);// wait 0.5 seconds
digitalWrite(yellowled, LOW);// turn off yellow LED
} 
delay(500);// wait 0.5 seconds
digitalWrite(redled, HIGH);// turn on red LED
delay(5000);// wait 5 seconds
digitalWrite(redled, LOW);// turn off red LED
}


Test Result

Done uploading the code, powered up, three LEDs on the module will automatically simulate the traffic light running.
thumb


For further study, you can connect it to your PI. An example as below figure shown.
thumb


Resources

Datasheet:
https://drive.google.com/open?id=1kRW1oUF6lrusVFcy-ABDWWKl-R7K1uZC


Buy From

Like it? You can click the links below to get one now. Enjoy your time!

Official Website:
http://www.keyestudio.com/ks0310.html

From AliExpress: [1]

From ebay: [2]