In this project, we'll create an application using the CY8CKIT-050 PSoC 5LP development kit to control an LED using both hardware and software. The LED's state will change each time a button is pressed. This experiment helps you understand how to use digital input and output pins along with software control in PSoC Creator.
PSoC schematic diagram
The controlling LED with hardware/software 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_SW.
Hardware Configuration:
Go to the Component Catalog on the right side of the screen, search for "Digital Input Pin" and drag it to the TopDesign schematic.
Add a "Digital Output Pin" and connect it.
Component Configuration:
Double-click on the Digital Input Pin, rename it to "BUTTON", choose Resistive Pull Up drive mode, and uncheck HW connection.
Double-click on the Digital Output Pin, rename it to "LED", choose Strong Drive mode, uncheck HW connection, and set the initial drive state to Low.
In the workspace explorer, double-click on Pins under Control_LED_SW.cydwr and set Port to P6[1] for the BUTTON and P6[3] for the LED.
Programming and Results:
Double-click on main.c in the workspace explorer under source files.
Add the code to control the LED with a button press.
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 toggle the LED on and off.
Code for main.c
PSoC real-life implementation