Complete Build
Dependencies: 4DGL-uLCD-SE1 Motor SDFileSystem X_NUCLEO_53L0A1 mbed-rtos mbed BotwithWavePlayerLevel
Fork of BotWithBluetoothLIDARV2 by
main.cpp
- Committer:
- bdragon52
- Date:
- 2017-10-06
- Revision:
- 12:af37c8938aaf
- Parent:
- 11:0309bef74ba8
- Child:
- 13:ab6bbdd2447a
File content as of revision 12:af37c8938aaf:
#include "mbed.h" #include "rtos.h" #include "uLCD_4DGL.h" #include "SDFileSystem.h" #include "wave_player.h" SDFileSystem sd(p5, p6, p7, p9, "sd"); //SD card AnalogOut DACout(p18); wave_player waver(&DACout); PwmOut red(p23); PwmOut blue(p21); PwmOut green(p22); PwmOut myled(LED1); uLCD_4DGL uLCD(p28,p27,p30); Thread thread2; Thread thread3; Thread thread4; float y=0.0; void t2() { while (true) { int a=20; int r=8; uLCD.background_color(BLACK); uLCD.cls(); uLCD.filled_circle(a, 80-(y*80)+25, r, BLUE); uLCD.line(3,25,13,25,RED); uLCD.line(3,105,13,105,RED); //while(b<100){ // uLCD.filled_circle(a, b, r, BLUE); // b=b+1; // uLCD.filled_circle(a, b-1, r, BLACK); // uLCD.filled_circle(a, b, r, BLUE); // Thread::wait(1000.0*0.002); // } //while(b>50){ // uLCD.filled_circle(a, b, r, BLUE); // b=b-1; // uLCD.filled_circle(a, b+2, r, BLACK); // uLCD.filled_circle(a, b, r, BLUE); //Thread::wait(1000.0*0.002); // } Thread::wait(1000.0*0.02); } } void t3() { while (true) { Thread::wait(1000); } } void t4() { while (true) { Thread::wait(1000); } } int main() { thread2.start(t2); thread3.start(t3); thread4.start(t4); while(1) { for(double x=0.0; x <= 3.14159; x = x + 0.0314159) { y = sin(x); red= y*y*y; blue= y*y*y; green= y*y*y; Thread::wait(1000.0*.025); } red= 0.0; blue= 0.0; green= 0.0; Thread::wait(1000.0*2.5); } }