- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
Through this programing of the dice, I was able to learn various PSoC designs. For more information on designing electronic dice, see the previous posts "PSoC 4 Seven Eyes Dice" and “PSoC 4 Seven Eyes Dice with sound”. This time it is the modified version. From the previous program “Let's make the dice of seven eyes using on PSoC 4 with a proximity sensor,the protagonist of the gam...”, the decoder part of the circuit is simplified and the PWM part is modified to swap. I will explain the changes here.
The environment used is as follows:
・PSoC Creator 4.3
・CY8CKIT-044
- 1. Change of decoding part
The simplified circuit of the decoding section is as follows. Two inverter logic have been deleted from the previous time.
- 2. PWM uses swap function
The PWM_1 component settings are as follows. Check the Swap of Period.
- 3. Program changes
Swap is performed at the timing of the S/W side.
:
/* Enable and start PWM block. */
PWM_2_Start();
for(;;)
{
/* Update the baseline of the proximity sensor. */
CapSense_UpdateSensorBaseline(CapSense_PROXIMITYSENSOR__PROX);
/* Scan the proximity sensor. */
CapSense_ScanSensor(CapSense_PROXIMITYSENSOR__PROX);
while(CapSense_IsBusy())
{
/* Put the PSoC 4200M in Sleep power mode while the CapSense is scanning.
* The device wakes up using the interrupt generated by CapSense CSD Component
* after scanning. */
}
/* Check if proximity sensor is active. */
proximity = CapSense_CheckIsSensorActive(CapSense_PROXIMITYSENSOR__PROX);
if(proximity == ACTIVE)
{
/* Set the LED at a brightness level corresponding
* to the proximity distance. */
if(sw==0){
PWM_1_WritePeriodBuf(999);
PWM_1_WritePeriod(399);
PWM_1_WriteCounter(0);
PWM_1_Start(); // Start rolling dice
sw=1;
}
}
else /* Proximity sensor is inactive. */
{
if(sw==1){
/* Roll dice slowly */
PWM_1_TriggerCommand(1, PWM_1_CMD_CAPTURE);
CyDelay(1500); // keep rolling slowly for 1.5sec
PWM_1_Stop();// Stop rolling dice
sw=0; // sw is off
}
}
}
:
When you bring your hand closer, the dice rotate, and when you move away, the rotation slows down and stops.
Thanks,
Kenshow
- Labels:
-
PSoC 345 LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi NoTa_4591161san,
Looks interesting! Thanks for your contribution
Regards,
Bragadeesh
Bragadeesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Bragadeesh,
It's not me.
Regards,
Noriaki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
NoriakiT_91-san, Sorry for the confusion. I've edited my previous response. Thanks for pointing it out!
Regards,
Bragadeesh
Bragadeesh