LED will be ON on touch

Dependencies:   mbed TSI

Committer:
zatharv
Date:
Fri May 20 08:23:42 2022 +0000
Revision:
0:3c056122d22d
.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
zatharv 0:3c056122d22d 1 //glow led on touch
zatharv 0:3c056122d22d 2
zatharv 0:3c056122d22d 3 #include "mbed.h"
zatharv 0:3c056122d22d 4 #include "TSISensor.h"
zatharv 0:3c056122d22d 5
zatharv 0:3c056122d22d 6 PwmOut red(LED1);
zatharv 0:3c056122d22d 7
zatharv 0:3c056122d22d 8 int main() {
zatharv 0:3c056122d22d 9 TSISensor tsi;
zatharv 0:3c056122d22d 10 while(1) {
zatharv 0:3c056122d22d 11 if (tsi.readPercentage())
zatharv 0:3c056122d22d 12 {
zatharv 0:3c056122d22d 13 red = 0;
zatharv 0:3c056122d22d 14 wait(0.1);
zatharv 0:3c056122d22d 15 }
zatharv 0:3c056122d22d 16 else
zatharv 0:3c056122d22d 17 {
zatharv 0:3c056122d22d 18 red = 1;
zatharv 0:3c056122d22d 19 }
zatharv 0:3c056122d22d 20 }
zatharv 0:3c056122d22d 21 }