![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Initial setup for different sensations on the MBED
Dependencies: mbed
Diff: main.cpp
- Revision:
- 0:f9023577fa6b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Nov 05 21:38:00 2015 +0000 @@ -0,0 +1,65 @@ +#include "mbed.h" + +Serial pc(USBTX,USBRX); +DigitalOut port1(p21); +DigitalOut port2(p22); +DigitalOut port3(p20); +DigitalOut port4(p19); +DigitalOut port5(p25); +DigitalOut port6(p26); + +int main() { + char buffer; + while(1) { + pc.printf("Press any key to generate a sensation\r\n"); + buffer = pc.getc(); + if (buffer == 'c') { + port1 = 1; + wait_ms(200); + port2 = 1; + port1 = 0; + wait_ms(200); + port3 = 1; + port2 = 0; + wait_ms(200); + port4 = 1; + port3 = 0; + wait_ms(200); + port5 = 1; + port4 = 0; + wait_ms(200); + port6 = 1; + port5 = 0; + wait_ms(200); + port6 = 0; + } else { + port1 = 1; + port2 = 1; + port3 = 1; + port4 = 1; + port5 = 1; + port6 = 1; + wait_ms(1000); + port1 = 0; + port2 = 0; + port3 = 0; + port4 = 0; + port5 = 0; + port6 = 0; + wait_ms(100); + port1 = 1; + port2 = 1; + port3 = 1; + port4 = 1; + port5 = 1; + port6 = 1; + wait_ms(1000); + port1 = 0; + port2 = 0; + port3 = 0; + port4 = 0; + port5 = 0; + port6 = 0; + } + } +}