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.
Fork of 01-01SolucionFuncionXY by
main.cpp@0:7ba873404776, 2018-02-20 (annotated)
- Committer:
- fabeltranm
- Date:
- Tue Feb 20 00:25:00 2018 +0000
- Revision:
- 0:7ba873404776
- Child:
- 1:370d6730c1cf
EJERCICIO 1
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| fabeltranm | 0:7ba873404776 | 1 | #include "mbed.h" |
| fabeltranm | 0:7ba873404776 | 2 | #define MAXPOS 50 // en milimetros |
| fabeltranm | 0:7ba873404776 | 3 | #define SS_TIME 100 // en microsegundos |
| fabeltranm | 0:7ba873404776 | 4 | |
| fabeltranm | 0:7ba873404776 | 5 | PwmOut myServoX(PB_3); |
| fabeltranm | 0:7ba873404776 | 6 | PwmOut myServoY(PB_4); |
| fabeltranm | 0:7ba873404776 | 7 | |
| fabeltranm | 0:7ba873404776 | 8 | |
| fabeltranm | 0:7ba873404776 | 9 | |
| fabeltranm | 0:7ba873404776 | 10 | void vertex2d(float x, float y){ |
| fabeltranm | 0:7ba873404776 | 11 | |
| fabeltranm | 0:7ba873404776 | 12 | // UBICAR EL CODIGO QUE HACE FALTA |
| fabeltranm | 0:7ba873404776 | 13 | |
| fabeltranm | 0:7ba873404776 | 14 | myServoX.pulsewidth_us(pulseX); |
| fabeltranm | 0:7ba873404776 | 15 | myServoY.pulsewidth_us(pulseY); |
| fabeltranm | 0:7ba873404776 | 16 | wait_ms(SS_TIME); |
| fabeltranm | 0:7ba873404776 | 17 | |
| fabeltranm | 0:7ba873404776 | 18 | } |
| fabeltranm | 0:7ba873404776 | 19 | |
| fabeltranm | 0:7ba873404776 | 20 | |
| fabeltranm | 0:7ba873404776 | 21 | int main() { |
| fabeltranm | 0:7ba873404776 | 22 | // configuracion de periodo |
| fabeltranm | 0:7ba873404776 | 23 | myServoX.period_ms(20); |
| fabeltranm | 0:7ba873404776 | 24 | myServoY.period_ms(20); |
| fabeltranm | 0:7ba873404776 | 25 | int posx=0; |
| fabeltranm | 0:7ba873404776 | 26 | int posy=0; |
| fabeltranm | 0:7ba873404776 | 27 | while(1) |
| fabeltranm | 0:7ba873404776 | 28 | { |
| fabeltranm | 0:7ba873404776 | 29 | wait(2); |
| fabeltranm | 0:7ba873404776 | 30 | vertex2d(posx,posy); |
| fabeltranm | 0:7ba873404776 | 31 | posx+=10; |
| fabeltranm | 0:7ba873404776 | 32 | posy+=10; |
| fabeltranm | 0:7ba873404776 | 33 | if (posx>50) posx=0; |
| fabeltranm | 0:7ba873404776 | 34 | if (posy>50) posy=0; |
| fabeltranm | 0:7ba873404776 | 35 | } |
| fabeltranm | 0:7ba873404776 | 36 | |
| fabeltranm | 0:7ba873404776 | 37 | } |
| fabeltranm | 0:7ba873404776 | 38 |
