Priyank Kalgaonkar
/
TALab3BVibMotorECE595
ECE595 - Lab 3 Part 2 - Grove Vibration Motor Program - TA
main.cpp@1:af23cbc41990, 2021-01-16 (annotated)
- Committer:
- priyank12p
- Date:
- Sat Jan 16 00:09:36 2021 +0000
- Revision:
- 1:af23cbc41990
- Parent:
- 0:4cb6e9d0da34
- Child:
- 2:af5f9d175643
initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
priyank12p | 0:4cb6e9d0da34 | 1 | #include "mbed.h" |
priyank12p | 0:4cb6e9d0da34 | 2 | |
priyank12p | 1:af23cbc41990 | 3 | DigitalOut buzzer(D2); |
priyank12p | 1:af23cbc41990 | 4 | DigitalOut led_green(LED_GREEN); |
priyank12p | 1:af23cbc41990 | 5 | InterruptIn sw2(SW2); |
priyank12p | 1:af23cbc41990 | 6 | |
priyank12p | 1:af23cbc41990 | 7 | void sw2_release(void) |
priyank12p | 1:af23cbc41990 | 8 | { |
priyank12p | 1:af23cbc41990 | 9 | led_green = !led_green; |
priyank12p | 1:af23cbc41990 | 10 | buzzer = !buzzer; |
priyank12p | 1:af23cbc41990 | 11 | |
priyank12p | 1:af23cbc41990 | 12 | printf("On-board button SW2 was released.\n"); |
priyank12p | 1:af23cbc41990 | 13 | } |
priyank12p | 0:4cb6e9d0da34 | 14 | |
priyank12p | 0:4cb6e9d0da34 | 15 | int main() |
priyank12p | 0:4cb6e9d0da34 | 16 | { |
priyank12p | 1:af23cbc41990 | 17 | sw2.rise(&sw2_release); |
priyank12p | 1:af23cbc41990 | 18 | while (true) { |
priyank12p | 0:4cb6e9d0da34 | 19 | } |
priyank12p | 1:af23cbc41990 | 20 | } |