Dependencies:   mbed

main.cpp

Committer:
JLS
Date:
2011-01-23
Revision:
0:66e8e6fa8997

File content as of revision 0:66e8e6fa8997:

#include "TFT_4DGL.h"

TFT_4DGL lcd(p9,p10,p11);

#define PI 3.14159265

struct point
{
    int x;
    int y;
};

point points[3];
point current;

int main() {
     
     int n = WHITE;
   
 for(int i=0; i<3; i++)
    {
        points[i].x = 150*sin(2*PI*i/3);
        points[i].y = 150*cos(2*PI*i/3);
    }
    
    current = points[rand()%3];
    
    while(1)
    {
    
        lcd.pixel(80+current.y,160+current.x,n);
        
        point nextpoint = points[rand()%3];
        
        current.x = (current.x + nextpoint.x)/2;
        current.y = (current.y + nextpoint.y)/2;
    }
}