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@0:8709fd38c8ee, 2018-10-29 (annotated)
- Committer:
- aldomarez
- Date:
- Mon Oct 29 18:32:27 2018 +0000
- Revision:
- 0:8709fd38c8ee
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| aldomarez | 0:8709fd38c8ee | 1 | #include "mbed.h" |
| aldomarez | 0:8709fd38c8ee | 2 | AnalogIn pot(A0); |
| aldomarez | 0:8709fd38c8ee | 3 | PwmOut motor(D6); |
| aldomarez | 0:8709fd38c8ee | 4 | |
| aldomarez | 0:8709fd38c8ee | 5 | int main() { |
| aldomarez | 0:8709fd38c8ee | 6 | //motor.period_us(20000); |
| aldomarez | 0:8709fd38c8ee | 7 | while(1) { |
| aldomarez | 0:8709fd38c8ee | 8 | float ancho = pot*1000.0; |
| aldomarez | 0:8709fd38c8ee | 9 | float anchoservo= 2000.0 - ancho; |
| aldomarez | 0:8709fd38c8ee | 10 | //motor.write(ancho); |
| aldomarez | 0:8709fd38c8ee | 11 | motor.pulsewidth_us(anchoservo); |
| aldomarez | 0:8709fd38c8ee | 12 | |
| aldomarez | 0:8709fd38c8ee | 13 | } |
| aldomarez | 0:8709fd38c8ee | 14 | } |
| aldomarez | 0:8709fd38c8ee | 15 |