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