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 "ADXL.h" 00003 #include "Arial12x12.h" 00004 #include "Arial24x23.h" 00005 #include "ILI932x.h" 00006 00007 Serial pc(USBTX, USBRX); 00008 float data[6]; 00009 PinName dataBus[]= {p30, p29, p28, p27, p26, p25, p24, p23}; 00010 ILI932x myLCD(BUS_8, dataBus, p15, p17, p16, p14, p20, "myLCD", 240, 320); // Bus 8 bit, bus pin array, CS, RST, DC, WR, RD, name, xpixels, ypixels 00011 char orient=4; 00012 int X = 120, Y = 160, oldY, oldX; 00013 00014 int main() { 00015 accConfig(); 00016 myLCD.set_orientation(orient); 00017 //t.start(); 00018 myLCD.set_font((unsigned char*) Arial12x12); 00019 myLCD.background(Black); // set background to red 00020 myLCD.foreground(White); // set chars to black 00021 myLCD.cls(); // clear the screen 00022 /* 00023 myLCD.locate((myLCD.width()-7)/2,myLCD.height()/2); // from our view, first is yPos, second is xPos 00024 myLCD.printf("Target Practice\r\n"); 00025 wait(2); 00026 myLCD.cls(); 00027 */ 00028 wait(1); 00029 myLCD.circle(120,160,12,White); 00030 while(1) { 00031 //temporary code: 00032 myLCD.fillcircle(oldX,oldY,6,Black); 00033 myLCD.fillcircle(X,Y,6,Blue); 00034 oldX = X; 00035 oldY = Y; 00036 getAccel(data); 00037 pc.printf("x = %1.2fg\t y = %1.2fg\t z = %1.2fg \n\r", data[0], data[1], data[2]); //print 00038 if (((X + data[0]) < myLCD.width()-10) && (X + data[0]) > 10) 00039 X += data[0]*30; 00040 if ((Y + data[1]) < myLCD.height()-10 && (Y + data[1]) > 10) 00041 Y -= data[1]*30; 00042 wait(0.002); 00043 00044 //insert correct code here: 00045 00046 } 00047 }
Generated on Fri Jul 15 2022 22:03:38 by
1.7.2