assignment 6 360- part 1 is complete-freeze balls on lcd screen with a hardware interrupt/button
Dependencies: 4DGL-uLCD-SE MMA8452Q_withfreefall bouncing_ball mbed
Fork of Assignment6 by
main.cpp
- Committer:
- slicht
- Date:
- 2017-10-24
- Revision:
- 1:6b99ffa62cc8
- Parent:
- 0:8d3812068c6c
- Child:
- 2:552e6feb8709
File content as of revision 1:6b99ffa62cc8:
// Demo for the uLCD-144-G2 and MMA8452Q 3-axis accelerometer #include "mbed.h" #include "MMA8452Q.h" #include "uLCD_4DGL.h" #include "bouncing_ball.h" #define INIT_RADIUS 10 #define INIT_COLOR 1 //#include "bouncing_ball.h" // Graphic LCD - TX, RX, and RES pins uLCD_4DGL uLCD(p9,p10,p11); // Accelerometer - SDA, SCL, and I2C address MMA8452Q accel(p28, p27, 0x1D); physics_ball ball1(INIT_COLOR,INIT_RADIUS); int main() { // Initialize uLCD uLCD.baudrate(115200); uLCD.background_color(BLACK); uLCD.cls(); // Initialize accelerometer accel.init(); //Initiailize ball // Make a ball "fall" in direction of accelerometer while (1) { // Draw a red circle uLCD.filled_circle((int)ball1.posx, (int)ball1.posy, ball1.radius, RED); // Wait before erasing old circle wait(0.02); // In seconds // Erase old circle uLCD.filled_circle((int)ball1.posx, (int)ball1.posy, ball1.radius, BLACK); } }