Skip to content

Commit d9ff882

Browse files
committed
Updated the code
1 parent a6faa95 commit d9ff882

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

pic24f-lcd-usb-curiosity-pwm-rgb-led.X/MyConfig.mc3

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<config configVersion="1.1" device="PIC24FJ512GU410" coreVersion="5.0.0">
1+
<config configVersion="1.1" device="PIC24FJ512GU410" coreVersion="5.0.1">
22
<usedClasses class="java.util.HashMap">
33
<entry>
44
<string>Main Manager</string>

pic24f-lcd-usb-curiosity-pwm-rgb-led.X/application/demo.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ limitations under the License.
2626
//Application related definitions
2727
//------------------------------------------------------------------------------
2828
#define BUTTON_DEBOUCE_TIME_MS 20
29+
#define RED_COLOR_LED_INTENSITY 600
30+
#define GREEN_COLOR_LED_INTENSITY 300
31+
#define BLUE_COLOR_LED_INTENSITY 150
2932

3033
typedef enum
3134
{
@@ -39,9 +42,9 @@ typedef enum
3942
//------------------------------------------------------------------------------
4043
static volatile BUTTON_COLOR button_color = BUTTON_COLOR_RED;
4144
static uint16_t potentiometer;
42-
static uint16_t red = 600;
43-
static uint16_t green = 300;
44-
static uint16_t blue = 150;
45+
static uint16_t red = RED_COLOR_LED_INTENSITY;
46+
static uint16_t green = GREEN_COLOR_LED_INTENSITY;
47+
static uint16_t blue = BLUE_COLOR_LED_INTENSITY;
4548

4649
//------------------------------------------------------------------------------
4750
//Function prototypes
@@ -166,7 +169,7 @@ static void ButtonS1Debounce(void)
166169
static uint16_t debounceCounter = 0;
167170

168171
//Sample the button S1 to see if it is currently pressed or not.
169-
if(BUTTON_IsPressed(BUTTON_S1))
172+
if(!BUTTON_IsPressed(BUTTON_S1))
170173
{
171174
//The button is currently pressed. Turn on the general purpose LED.
172175
LED1_On();
@@ -216,7 +219,7 @@ static void ButtonS2Debounce(void)
216219
static uint16_t debounceCounter = 0;
217220

218221
//Sample the button S2 to see if it is currently pressed or not.
219-
if(BUTTON_IsPressed(BUTTON_S2))
222+
if(!BUTTON_IsPressed(BUTTON_S2))
220223
{
221224
//The button is currently pressed. Turn on the general purpose LED.
222225
LED2_On();

0 commit comments

Comments
 (0)