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
00001 #include "mbed.h" 00002 #include "MobileLCD.h" 00003 00004 #define PI 3.1415926535897 00005 MobileLCD lcd(5, 6, 7, 8, 9); 00006 DigitalIn Plus(20); 00007 DigitalIn Minus(19); 00008 AnalogIn Potent(18); 00009 struct point 00010 { 00011 int x; 00012 int y; 00013 }; 00014 00015 int numpoints = 10; 00016 point points[256]; 00017 00018 int main() 00019 { 00020 while(1) 00021 { 00022 for(int i=0; i<numpoints; i++) 00023 { 00024 points[i].x = 65+60*sin(2*PI*i/numpoints); 00025 points[i].y = 65+60*cos(2*PI*i/numpoints); 00026 } 00027 lcd.background(0x0); 00028 lcd.cls(); 00029 for(int i=0; i<numpoints; i++) 00030 { 00031 for(int j=i+1; j<numpoints; j++) 00032 { 00033 lcd.line(points[i].x,points[i].y,points[j].x,points[j].y,0xFFFFFF); 00034 } 00035 } 00036 /* 00037 while(1) 00038 { 00039 if(Plus && numpoints<256-1) 00040 { 00041 numpoints++; 00042 while(Plus); 00043 break; 00044 } 00045 else if(Minus && numpoints>3+1) 00046 { 00047 numpoints--; 00048 while(Minus); 00049 break; 00050 } 00051 }*/ 00052 while(1) 00053 { 00054 float theta = Potent; 00055 if(abs(numpoints - theta*20)>1) 00056 { 00057 numpoints = ceil(theta*20); 00058 break; 00059 } 00060 } 00061 } 00062 }
Generated on Tue Jul 12 2022 15:04:07 by
1.7.2