Markus Müller
/
ampel_01
fabian lutscht :o
main.cpp
- Committer:
- p0ckin3d
- Date:
- 2014-05-28
- Revision:
- 2:cd8fa44e7f22
- Parent:
- 1:69b163b1e72d
File content as of revision 2:cd8fa44e7f22:
#include "mbed.h" BusOut rgb(p23, p24, p25); InterruptIn button(p14); PwmOut speaker(p26); AnalogIn poti(p19); AnalogIn poti2(p20); void start() { for(unsigned char i=0; i < 4; i++) { rgb = ~0x02; wait(1); rgb = 0xFF; wait(1); } rgb = ~0x03; wait(3); rgb = ~0x01; for(unsigned char i = 0; i < 50; i++) { speaker.period_us(poti.read() * 1000); speaker.write(0.9); wait(0.1); speaker.write(0.0); wait(poti2.read()); } speaker.write(0.0); rgb = ~0x03; speaker.write(0.0); wait(3); rgb = ~0x02; } int main() { button.rise(&start); speaker.period_us(1000); rgb = ~0x02; while(1) { } }