TSI read values are now sent to the serial port. Red LED part of the RGB will light up with an intensity that depends on the TSI read value.

Dependencies:   TSI mbed

Fork of FRDM_TSI by mbed official

Committer:
lmsousa
Date:
Thu May 07 11:25:42 2015 +0000
Revision:
6:288cb3530ef4
Parent:
1:51b1b688179a
Sends TSI read value to the serial port.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emilmont 0:0f00f07ebde0 1 #include "mbed.h"
chris 1:51b1b688179a 2 #include "TSISensor.h"
lmsousa 6:288cb3530ef4 3 Serial pc(USBTX, USBRX);
emilmont 0:0f00f07ebde0 4
lmsousa 6:288cb3530ef4 5 int main(void)
lmsousa 6:288cb3530ef4 6 {
lmsousa 6:288cb3530ef4 7 pc.baud(9600);
lmsousa 6:288cb3530ef4 8 PwmOut rled(LED_RED);
chris 1:51b1b688179a 9 TSISensor tsi;
lmsousa 6:288cb3530ef4 10 rled=1;
lmsousa 6:288cb3530ef4 11
lmsousa 6:288cb3530ef4 12 while (true)
lmsousa 6:288cb3530ef4 13 {
lmsousa 6:288cb3530ef4 14 float n=tsi.readPercentage();
lmsousa 6:288cb3530ef4 15 pc.printf("Percentage= %3.0f %% \r\n ",n*100);
lmsousa 6:288cb3530ef4 16 rled = 1.0 - n;
lmsousa 6:288cb3530ef4 17 wait(0.1);
lmsousa 6:288cb3530ef4 18 }
lmsousa 6:288cb3530ef4 19 }