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: mbed
main.cpp@1:91e1f50eac98, 2014-12-18 (annotated)
- Committer:
- tbjazic
- Date:
- Thu Dec 18 07:37:45 2014 +0000
- Revision:
- 1:91e1f50eac98
- Parent:
- 0:0713d899de2b
Cast operator (float) added for accurate division, and maximum number of points reduced to 50.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| tbjazic | 0:0713d899de2b | 1 | #include "mbed.h" |
| tbjazic | 0:0713d899de2b | 2 | |
| tbjazic | 0:0713d899de2b | 3 | AnalogOut out(p18); |
| tbjazic | 0:0713d899de2b | 4 | AnalogIn pot1(p19); |
| tbjazic | 0:0713d899de2b | 5 | |
| tbjazic | 0:0713d899de2b | 6 | int main() { |
| tbjazic | 0:0713d899de2b | 7 | int numberOfPoints; |
| tbjazic | 0:0713d899de2b | 8 | while(1) { |
| tbjazic | 1:91e1f50eac98 | 9 | numberOfPoints = 10 + pot1 * 40; // 10 to 50 points |
| tbjazic | 0:0713d899de2b | 10 | for (int i = 0; i < numberOfPoints; i++) { |
| tbjazic | 1:91e1f50eac98 | 11 | out = (float) i / numberOfPoints; |
| tbjazic | 0:0713d899de2b | 12 | wait_us(10000/numberOfPoints); |
| tbjazic | 0:0713d899de2b | 13 | } |
| tbjazic | 0:0713d899de2b | 14 | } |
| tbjazic | 0:0713d899de2b | 15 | } |