- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am very new to PSoC, and have very limited experience with C++, and none with C. I am trying to read the signal on a pin and toggle a boolean value to change the blinking speed of an external LED. Here's the code:
int main()
{
bool button1;
LCD_Char_Start();
LCD_Char_PrintString("Hola Mundo!");
for(;;)
{
if(CyPins_ReadPin(Pin_1_0) !=0) {
button1 = !button1;
CyDelay(100);
}
if(button1) {
CyDelay(1000u);
} else {
CyDelay(250u);
}
P0_0_Write(!P0_0_Read());
}
}
The CyPins thing I got from another thread and the LCD stuff is from the Hello World example project. The LCD doesn't work though. I also kept include project.h and added stdbool.h for booleans. Any idea what I might be doing wrong?
Edit: I should probably mention I have the CY8CKIT-059 and if it matters to mention too, the chip is the CY8C5888LTI-LP097.
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My goal is to do it in code so I can learn C though. I want to be able to make an LCD have a menu that I can go through with buttons for a signal generator, but for now, the LED is all, the basics.
Edit: Sorry if I sounded harsh, but I was a bit peeved after trying at the LCD with example code. Thanks for the input 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you please post your complete project, so that we all can have a look at all of your settings. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You guys may be glad to know I got the LCD working, I had the first two pins on the port, pins 4 and 5 on the 44780 display swapped. But the problem with pin reading still stands ;(
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yoy may use Pin_2_Read() which is independent from changing the underlying real pin. When the pin is connected to a switch that connects the pin to GND (which is the usual/preferred case) the pin should be configured as resistive pull up, initial drive high.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks so much Bob! 😄
I was in Toronto all yesterday so I couldn't reach the web. Now I got to decide what to make my PSoC do 🙂