In this project, we'll build an application using the CY8CKIT-050 PSoC 5LP development kit to control an LED with a button. When the button is pressed, the LED will light up. This experiment helps you understand how to use digital input and output pins in PSoC Creator
PSoC schematic diagram
The controlling LED with hardware design project needs the following parts:
CY8CKIT-050 PSoC 5LP Development Kit
USB Cable
Push Button
Project Creation:
Open PSoC Creator.
Go to File > New > Project.
Choose the target device: PSoC5LP CY8CKIT-050 (CY8C5868AXI-LP035 chip).
Select "Empty Schematic" and name the project Control_LED_HW.
Hardware Configuration:
Go to the Component Catalog on the right side of the screen, search for "Logic AND" and drag it to the TopDesign schematic.
Add a "Logic NOT" component and connect it to the output of the AND component.
Add a "Digital Input Pin" and connect it to one input of the AND component.
Add a "Digital Output Pin" and connect it to the output of the NOT component.
Add a "Logic High" component and connect it to the other input of the AND component.
Component Configuration:
Double-click on the Digital Input Pin, rename it to "BUTTON", and set the drive mode to Resistive Pull Up.
In the workspace explorer, double-click on Pins under Control_LED_HW.cydwr and set Port to P6[1] for the BUTTON and P6[3] for the LED.
Programming and Results:
Build the design by clicking on "Build" or pressing Shift+F6.
Verify and resolve any warnings or errors.
Connect the PSoC 5LP to your computer using the USB cable.
Click on "Program" or press Ctrl+F5 to upload the code to the PSoC.
Press the button to see the LED light up.
Code for main.c
PSoC real-life implementation