![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
a
test2.cpp
- Committer:
- 12F2041G
- Date:
- 2014-07-02
- Revision:
- 3:4668311bb7f0
- Parent:
- 2:bd0c6b45d7cc
File content as of revision 3:4668311bb7f0:
#include "mbed.h" DigitalOut myled(P0_17); BusOut leds(P1_13, P1_14, P1_22, P0_17, P0_18, P0_19, P1_15, P0_1); void alle(); void all(); void rot(); void same(); void roll(); int main() { while(0x01) { myled = 0x01; wait(0.2); myled = 0x00; wait(0.2); alle(); leds = 0x00; wait(0.2); rot(); same(); roll(); } } void alle() { float i = 0.5; while(i>0){ leds = 0x00; wait(i); leds = 0xff; wait(i); i = i-0.05; } } void all() { leds = 0x00; wait(0.5); leds = 0xff; wait(0.5); } void rot() { int i; for(i=0x00; i<0x08; i++){ leds = 0x01<<i; wait(0.2); } leds = 0x00; wait(0.2); } void same() { int i; for(i=0x08; i>0x00; i--) { leds = 0x01 << i; wait(0.2); all(); } } void roll() { int i, j; for(i=0x08; i>=0x00; i--) { leds = 0x01 << i; wait(0.2); for(j=0x00; j<0x08; j++){ leds = 0x01 << j; wait(0.2); } } for(i=0x00; i<0x08; i++) { leds = 0x01 << i; wait(0.2); for(j=0x08; j>=0x00; j--){ leds = 0x01 << j; wait(0.2); } } }