From d6ac0d36db6a1c7f2a162c66cc00de5392bdcba1 Mon Sep 17 00:00:00 2001 From: aadit Date: Thu, 4 Sep 2025 12:47:15 +0530 Subject: [PATCH] Update ES/Lab/Lab7/SwitchCounter.c --- ES/Lab/Lab7/SwitchCounter.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ES/Lab/Lab7/SwitchCounter.c b/ES/Lab/Lab7/SwitchCounter.c index 07f82b9..ef3e13f 100644 --- a/ES/Lab/Lab7/SwitchCounter.c +++ b/ES/Lab/Lab7/SwitchCounter.c @@ -4,17 +4,17 @@ int main(){ unsigned long x, count = 0; - LPC_PINCON -> PINSEL0 = 0x0000<<8 ; // LED + LPC_PINCON -> PINSEL0 = 0x0000<<8 ; // LED LPC_PINCON -> PINSEL3 = 0; // SWITCH - LPC_GPIO0 -> FIODIR = 0xFF<<4; // LED - LPC_GPIO1 -> FIODIR = 0 << 23; // SWITCH + LPC_GPIO0 -> FIODIR = 0xFF<<4; // LED + LPC_GPIO1 -> FIODIR = 0 << 23; // SWITCH while(1){ - x = LPC_GPIO1 -> FIOPIN & 1 << 23; // Initial value to refer to + x = LPC_GPIO1 -> FIOPIN & 1 << 23; // Initial value to refer to if(!x){ count = (count + 1)%255; // Counter - LPC_GPIO0 -> FIOPIN = count << 4; // Modifying FIOPIN value to match count + LPC_GPIO0 -> FIOPIN = count << 4; // Modifying FIOPIN value to match count } }