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.
Dependencies: camera mbed tsi_sensor
Fork of Car2 by
main.cpp@1:63c28aae78c9, 2017-02-10 (annotated)
- Committer:
- l00p
- Date:
- Fri Feb 10 22:12:41 2017 +0000
- Revision:
- 1:63c28aae78c9
- Parent:
- 0:b761ef827157
- Child:
- 2:0db7cc5ad6db
added my comment
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
zamatthews | 0:b761ef827157 | 1 | #include "mbed.h" |
zamatthews | 0:b761ef827157 | 2 | #include "tsi_sensor.h" |
zamatthews | 0:b761ef827157 | 3 | |
zamatthews | 0:b761ef827157 | 4 | /* This defines will be replaced by PinNames soon */ |
zamatthews | 0:b761ef827157 | 5 | #if defined (TARGET_KL25Z) || defined (TARGET_KL46Z) |
zamatthews | 0:b761ef827157 | 6 | #define ELEC0 9 |
zamatthews | 0:b761ef827157 | 7 | #define ELEC1 10 |
zamatthews | 0:b761ef827157 | 8 | #elif defined (TARGET_KL05Z) |
zamatthews | 0:b761ef827157 | 9 | #define ELEC0 9 |
zamatthews | 0:b761ef827157 | 10 | #define ELEC1 8 |
zamatthews | 0:b761ef827157 | 11 | #else |
zamatthews | 0:b761ef827157 | 12 | #error TARGET NOT DEFINED |
zamatthews | 0:b761ef827157 | 13 | #endif |
zamatthews | 0:b761ef827157 | 14 | |
l00p | 1:63c28aae78c9 | 15 | //Erik's Comment |
l00p | 1:63c28aae78c9 | 16 | |
zamatthews | 0:b761ef827157 | 17 | int main(void) { |
zamatthews | 0:b761ef827157 | 18 | PwmOut led(LED_GREEN); |
zamatthews | 0:b761ef827157 | 19 | TSIAnalogSlider tsi(ELEC0, ELEC1, 40); |
zamatthews | 0:b761ef827157 | 20 | |
zamatthews | 0:b761ef827157 | 21 | while (true) { |
zamatthews | 0:b761ef827157 | 22 | led = 1.0 - tsi.readPercentage(); |
zamatthews | 0:b761ef827157 | 23 | wait(0.1); |
zamatthews | 0:b761ef827157 | 24 | } |
zamatthews | 0:b761ef827157 | 25 | } |