- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just want to change color on the RGB LED, I modify the PrISM example code.
here is the CODE:
void sleep(int s)
{
int x;
while(x<s)
x++;
}
int main()
{
/* Start PrISM */
PrISM_1_Start();
/* Enable Global Interrupts */
CyGlobalIntEnable;
/* No work has to be done in main loop */
while(1u){
PrISM_1_WritePulse0(255);
PrISM_1_WritePulse1(0);
sleep(1);
PrISM_1_WritePulse0(255);
PrISM_1_WritePulse1(255);
sleep(1);
}
}
but it only change two times, after that, it is no longer to change
Solved! Go to Solution.
- Labels:
-
BLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
SOLVED.
In FindMe Profile example code,I added two PrISM in schematic.
But I found that StackEventHandler() executed following on startup:
case CYBLE_EVT_GAP_DEVICE_DISCONNECTED:
/* Start BLE advertisement for 30 seconds and update link
* status on LEDs */
CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_FAST);
PrISM_1_WritePulse0(RGB_LED_ON);
PrISM_1_WritePulse1(RGB_LED_OFF);
PrISM_2_WritePulse0(RGB_LED_OFF);
RED_SetDriveMode(RED_DM_DIG_HIZ);
GREEN_SetDriveMode(RED_DM_STRONG);
BLUE_SetDriveMode(RED_DM_DIG_HIZ);
alertLevel = NO_ALERT;
break;
After this, the RGB LED will always turn on all the pulse density value (0), so that RGB LED is always WHITE!
And I can't to control it with new pulse density value, it seems blocks by something...
How could I to handle this? Thanks a lot!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
void sleep(int s)
{
int x=0;
while(x<s*1000000)
x++;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Welcome in the forum, Mop.
/* No work has to be done in main loop */
Take that comment literally! What you are doing is to change the PrISM parameters at a frequency which you cannot observe with the naked eye. Your first sleep() just needs less than 1µs to return. Better (easier, but more complex) would be to use a timer that changes every second your PrISM. To have something you can rely on use CyDelay(number of ms) description in "System Reference Guide"
It is always easier for us when you 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. And do not forget to mention which kit you actually use.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
SOLVED.
In FindMe Profile example code,I added two PrISM in schematic.
But I found that StackEventHandler() executed following on startup:
case CYBLE_EVT_GAP_DEVICE_DISCONNECTED:
/* Start BLE advertisement for 30 seconds and update link
* status on LEDs */
CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_FAST);
PrISM_1_WritePulse0(RGB_LED_ON);
PrISM_1_WritePulse1(RGB_LED_OFF);
PrISM_2_WritePulse0(RGB_LED_OFF);
RED_SetDriveMode(RED_DM_DIG_HIZ);
GREEN_SetDriveMode(RED_DM_STRONG);
BLUE_SetDriveMode(RED_DM_DIG_HIZ);
alertLevel = NO_ALERT;
break;
After this, the RGB LED will always turn on all the pulse density value (0), so that RGB LED is always WHITE!
And I can't to control it with new pulse density value, it seems blocks by something...
How could I to handle this? Thanks a lot!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content