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:c2992d2f3c66, 2011-01-03 (annotated)
- Committer:
- JLS
- Date:
- Mon Jan 03 21:35:33 2011 +0000
- Revision:
- 0:c2992d2f3c66
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| JLS | 0:c2992d2f3c66 | 1 | #include "TFT_4DGL.h" |
| JLS | 0:c2992d2f3c66 | 2 | |
| JLS | 0:c2992d2f3c66 | 3 | TFT_4DGL lcd(p9,p10,p11); |
| JLS | 0:c2992d2f3c66 | 4 | |
| JLS | 0:c2992d2f3c66 | 5 | int main() { |
| JLS | 0:c2992d2f3c66 | 6 | |
| JLS | 0:c2992d2f3c66 | 7 | double x1,y1,z1,x,y,z,dt; |
| JLS | 0:c2992d2f3c66 | 8 | int xp,yp; |
| JLS | 0:c2992d2f3c66 | 9 | |
| JLS | 0:c2992d2f3c66 | 10 | float a = 2.017; |
| JLS | 0:c2992d2f3c66 | 11 | |
| JLS | 0:c2992d2f3c66 | 12 | x1 = -0.9; |
| JLS | 0:c2992d2f3c66 | 13 | y1 = 0; |
| JLS | 0:c2992d2f3c66 | 14 | z1 = 0.5; |
| JLS | 0:c2992d2f3c66 | 15 | |
| JLS | 0:c2992d2f3c66 | 16 | dt = 0.01; |
| JLS | 0:c2992d2f3c66 | 17 | |
| JLS | 0:c2992d2f3c66 | 18 | while(1) |
| JLS | 0:c2992d2f3c66 | 19 | |
| JLS | 0:c2992d2f3c66 | 20 | { |
| JLS | 0:c2992d2f3c66 | 21 | |
| JLS | 0:c2992d2f3c66 | 22 | x = x1+(y1)*dt; |
| JLS | 0:c2992d2f3c66 | 23 | y = y1+(z1)*dt; |
| JLS | 0:c2992d2f3c66 | 24 | z = z1+(-a*z1+pow(y1,2)-x1)*dt; |
| JLS | 0:c2992d2f3c66 | 25 | |
| JLS | 0:c2992d2f3c66 | 26 | xp = 55+(int)floor(34*x); |
| JLS | 0:c2992d2f3c66 | 27 | yp = 135+(int)floor(39*y); |
| JLS | 0:c2992d2f3c66 | 28 | |
| JLS | 0:c2992d2f3c66 | 29 | lcd.pixel(yp,xp,WHITE); |
| JLS | 0:c2992d2f3c66 | 30 | |
| JLS | 0:c2992d2f3c66 | 31 | x1 = x; |
| JLS | 0:c2992d2f3c66 | 32 | y1 = y; |
| JLS | 0:c2992d2f3c66 | 33 | z1 = z; |
| JLS | 0:c2992d2f3c66 | 34 | |
| JLS | 0:c2992d2f3c66 | 35 | } |
| JLS | 0:c2992d2f3c66 | 36 | |
| JLS | 0:c2992d2f3c66 | 37 | } |