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