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.
Dependencies: SDFileSystem mbed
Fork of PES4_Programme by
Diff: source/main.cpp
- Revision:
- 70:cc7ed2325202
- Parent:
- 69:ec1cfc0cd161
- Child:
- 71:3d0a4dbff536
--- a/source/main.cpp Fri Apr 06 06:25:36 2018 +0000 +++ b/source/main.cpp Fri Apr 06 06:47:53 2018 +0000 @@ -31,12 +31,12 @@ int i=0; int rx_i=0; -/* + // Setup a serial interrupt function to receive data pc.attach(&Rx_interrupt, Serial::RxIrq); // Setup a serial interrupt function to transmit data pc.attach(&Tx_interrupt, Serial::TxIrq); -*/ + @@ -83,7 +83,7 @@ break; case 3: break; -/* + case 10: // Formatted IO test using send and receive serial interrupts // with sprintf and sscanf @@ -118,8 +118,8 @@ } } break; - - */ + + case 11: break; @@ -189,6 +189,7 @@ case 47: printf("\n\rState Switch: Enter next State: \n\r"); printf("45\tset Time\n\r46\tread Time\n\r47\tState Switch\n\r48\tServo Board Test Tool\n\r49\tenable servo output\n\r50\tdisable servo output\n\r51\ttest SD Card\n\r52\tread medication\n\r53\tMedication display test tool\n\r"); + printf("54\tWrite Medication\n\r55\tDemo Tool for Summer and RGB LED\n\r"); pc.scanf("%d", &state); printf("Switch to State %d\n\r",state); fflush(stdin); @@ -275,54 +276,59 @@ /* Demo Tool */ enableOutput(); printf("Servo output enabled\r\n\n"); - //summer.period_us(500); - //summer.write(0.5f); - //wait(3); - //summer.write(0.0f); + summer.period_us(500); + summer.write(0.5f); + wait(3); + summer.write(0.0f); - //userButton1.fall(&summ); + userButton1.fall(&summ); + + printf("Summer Interrupt on Button 0 enabled\n\r"); color = 0xFFFFFF; colorTime = 0; - setLED(0,color); wait(5); - printf("start loop\n\r"); + + printf("start fading loop for DEMOTIME loops\n\r"); + while(colorTime < DEMOTIME) { printf("fade1\n\r"); for(r = 0; r <= 255; r++) { color &= 0x00FFFF; color |= (r<<16); - printf("color = %d\n\r",color); setLED(0,color); wait_ms(FADESPEED); } - printf("fade2"); + printf("fade2\n\r"); for(b = 255; b >= 0; b--) { color &= 0xFFFF00; color |= b; setLED(0,color); wait_ms(FADESPEED); } - printf("fade3"); + printf("fade3\n\r"); for(g = 0; g <= 255; g++) { color &= 0xFF00FF; color |= (g<<8); setLED(0,color); wait_ms(FADESPEED); } + printf("fade4\n\r"); for(r = 255; r > 0; r--) { color &= 0x00FFFF; color |= (r<<16); setLED(0,color); wait_ms(FADESPEED); } + printf("fade5\n\r"); for(b = 0; b <= 255; b++) { color &= 0xFFFF00; color |= b; setLED(0,color); wait_ms(FADESPEED); } + printf("fade6\n\r"); for (g = 255; g > 0; g--) { color &= 0xFF00FF; color |= (g<<8); @@ -331,7 +337,7 @@ } colorTime++; } - printf("exit demo"); + printf("exit demo tool\n\r"); break; default: