Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
- Committer:
- zatharv
- Date:
- 2022-05-20
- Revision:
- 0:3dd8497f9f22
File content as of revision 0:3dd8497f9f22:
//different colour on 2 sides of sensor
#include "mbed.h"
#include "TSISensor.h"
PwmOut red(LED1);
PwmOut blue(LED3);
int main() {
TSISensor tsi;
while(1) {
if (tsi.readPercentage())
{
if (tsi.readDistance() > 20)
{
blue = 1;
red = 0;
wait(0.1);
}
else
{
red = 1;
blue = 0;
}
}
else
{
blue = 1;
red = 1;
}
}
}