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:db74f9c82799, 2011-01-21 (annotated)
- Committer:
- JLS
- Date:
- Fri Jan 21 17:41:09 2011 +0000
- Revision:
- 0:db74f9c82799
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| JLS | 0:db74f9c82799 | 1 | #include "TFT_4DGL.h" |
| JLS | 0:db74f9c82799 | 2 | |
| JLS | 0:db74f9c82799 | 3 | TFT_4DGL lcd(p9,p10,p11); |
| JLS | 0:db74f9c82799 | 4 | |
| JLS | 0:db74f9c82799 | 5 | int main() { |
| JLS | 0:db74f9c82799 | 6 | |
| JLS | 0:db74f9c82799 | 7 | int xp,yp; |
| JLS | 0:db74f9c82799 | 8 | |
| JLS | 0:db74f9c82799 | 9 | int n = WHITE; |
| JLS | 0:db74f9c82799 | 10 | |
| JLS | 0:db74f9c82799 | 11 | float x,y,z; |
| JLS | 0:db74f9c82799 | 12 | |
| JLS | 0:db74f9c82799 | 13 | float a = -0.75; |
| JLS | 0:db74f9c82799 | 14 | float b = 2.44; |
| JLS | 0:db74f9c82799 | 15 | float c = 1.25; |
| JLS | 0:db74f9c82799 | 16 | float d = 1.5; |
| JLS | 0:db74f9c82799 | 17 | |
| JLS | 0:db74f9c82799 | 18 | float x1 = 0.1; |
| JLS | 0:db74f9c82799 | 19 | float y1 = -0.4; |
| JLS | 0:db74f9c82799 | 20 | float z1 = 0.1; |
| JLS | 0:db74f9c82799 | 21 | |
| JLS | 0:db74f9c82799 | 22 | while(1) |
| JLS | 0:db74f9c82799 | 23 | |
| JLS | 0:db74f9c82799 | 24 | { |
| JLS | 0:db74f9c82799 | 25 | |
| JLS | 0:db74f9c82799 | 26 | x = sin(a*y1)-z1*cos(b*x1); |
| JLS | 0:db74f9c82799 | 27 | y = z*sin(c*x1)-cos(d*y1); |
| JLS | 0:db74f9c82799 | 28 | z = sin(x1); |
| JLS | 0:db74f9c82799 | 29 | |
| JLS | 0:db74f9c82799 | 30 | xp = (int)floor(x*265); |
| JLS | 0:db74f9c82799 | 31 | yp = (int)floor(y*245); |
| JLS | 0:db74f9c82799 | 32 | |
| JLS | 0:db74f9c82799 | 33 | lcd.pixel(80+xp,270+yp,n); |
| JLS | 0:db74f9c82799 | 34 | |
| JLS | 0:db74f9c82799 | 35 | x1 = x; |
| JLS | 0:db74f9c82799 | 36 | y1 = y; |
| JLS | 0:db74f9c82799 | 37 | z1 = z; |
| JLS | 0:db74f9c82799 | 38 | |
| JLS | 0:db74f9c82799 | 39 | } |
| JLS | 0:db74f9c82799 | 40 | |
| JLS | 0:db74f9c82799 | 41 | } |