승규 김
/
flexSensor_PWM_bt
flexSensor + ledPWM + bluetooth
main.cpp@0:5f93dfb618bf, 2019-07-19 (annotated)
- Committer:
- airaen0129
- Date:
- Fri Jul 19 05:41:58 2019 +0000
- Revision:
- 0:5f93dfb618bf
- Child:
- 1:0e180bcfcdae
COMMIT test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
airaen0129 | 0:5f93dfb618bf | 1 | /* mbed Microcontroller Library |
airaen0129 | 0:5f93dfb618bf | 2 | * Copyright (c) 2018 ARM Limited |
airaen0129 | 0:5f93dfb618bf | 3 | * SPDX-License-Identifier: Apache-2.0 |
airaen0129 | 0:5f93dfb618bf | 4 | */ |
airaen0129 | 0:5f93dfb618bf | 5 | |
airaen0129 | 0:5f93dfb618bf | 6 | #include "mbed.h" |
airaen0129 | 0:5f93dfb618bf | 7 | #include "Map.hpp" |
airaen0129 | 0:5f93dfb618bf | 8 | |
airaen0129 | 0:5f93dfb618bf | 9 | AnalogIn flexSensor(PA_7); |
airaen0129 | 0:5f93dfb618bf | 10 | Map map(0.9, 0.99999999, 0, 10000); |
airaen0129 | 0:5f93dfb618bf | 11 | int main() { |
airaen0129 | 0:5f93dfb618bf | 12 | while (true) { |
airaen0129 | 0:5f93dfb618bf | 13 | float analogValue = flexSensor; |
airaen0129 | 0:5f93dfb618bf | 14 | |
airaen0129 | 0:5f93dfb618bf | 15 | wait(0.5); |
airaen0129 | 0:5f93dfb618bf | 16 | printf("%d\n", (int)map.Calculate(analogValue)); |
airaen0129 | 0:5f93dfb618bf | 17 | } |
airaen0129 | 0:5f93dfb618bf | 18 | } |