3 key touch panel from Seeed
Fork of Seeed_Grove_I2C_Touch_Example by
main.cpp@5:50d9e7608cf0, 2017-06-29 (annotated)
- Committer:
- Nate Yonkee
- Date:
- Thu Jun 29 10:40:14 2017 -0600
- Revision:
- 5:50d9e7608cf0
- Parent:
- 3:81ea1b6e3fea
- Child:
- 8:59e43faffe44
use thread wait to take advantage of power saving
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sam_grove | 0:6f4bcfe86ac2 | 1 | #include "mbed.h" |
tulanthoar | 3:81ea1b6e3fea | 2 | #include "rtos.h" |
sam_grove | 0:6f4bcfe86ac2 | 3 | #include "MPR121.h" |
sam_grove | 0:6f4bcfe86ac2 | 4 | |
sam_grove | 2:383e257538ff | 5 | I2C i2c(D14, D15); |
sam_grove | 2:383e257538ff | 6 | MPR121 touch_pad(i2c, MPR121::ADDR_VSS); |
sam_grove | 0:6f4bcfe86ac2 | 7 | |
Nate Yonkee |
5:50d9e7608cf0 | 8 | int main() |
Nate Yonkee |
5:50d9e7608cf0 | 9 | { |
sam_grove | 2:383e257538ff | 10 | uint16_t button_val = 0; |
Nate Yonkee |
5:50d9e7608cf0 | 11 | |
sam_grove | 0:6f4bcfe86ac2 | 12 | touch_pad.init(); |
sam_grove | 0:6f4bcfe86ac2 | 13 | touch_pad.enable(); |
Nate Yonkee |
5:50d9e7608cf0 | 14 | |
sam_grove | 0:6f4bcfe86ac2 | 15 | while(1) |
sam_grove | 0:6f4bcfe86ac2 | 16 | { |
sam_grove | 2:383e257538ff | 17 | button_val = touch_pad.buttonPressed(); |
sam_grove | 2:383e257538ff | 18 | printf("button = 0x%04x\n", button_val); |
Nate Yonkee |
5:50d9e7608cf0 | 19 | Thread::wait(100); |
sam_grove | 0:6f4bcfe86ac2 | 20 | } |
sam_grove | 0:6f4bcfe86ac2 | 21 | } |