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