
Code-Basis für Programm zum Taster-Entprellen
Fork of Laser-Distance by
main.cpp@10:f727c310c86f, 2018-09-30 (annotated)
- Committer:
- KStefan
- Date:
- Sun Sep 30 21:33:03 2018 +0000
- Revision:
- 10:f727c310c86f
- Parent:
- 9:a4a4f8cc4019
- Child:
- 11:b68be9bd5754
Cleanup
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andcor02 | 0:80032665d37e | 1 | #include "mbed.h" |
KStefan | 8:0f74264cc38a | 2 | #include "SB1602E.h" |
andcor02 | 5:1fca2683ae6f | 3 | #define USE_I2C_2V8 |
andcor02 | 0:80032665d37e | 4 | |
KStefan | 9:a4a4f8cc4019 | 5 | DigitalOut myled(P0_8); // 7=rot, 8=grün, 9=blau |
KStefan | 9:a4a4f8cc4019 | 6 | DigitalIn sw_o(P0_12); |
KStefan | 9:a4a4f8cc4019 | 7 | DigitalIn sw_b(P0_13); |
KStefan | 9:a4a4f8cc4019 | 8 | DigitalIn sw_g(P0_14); |
andcor02 | 5:1fca2683ae6f | 9 | |
KStefan | 9:a4a4f8cc4019 | 10 | I2C i2c_disp(P0_5, P0_4); // SDA, SCL auf LPC11U24 |
KStefan | 9:a4a4f8cc4019 | 11 | SB1602E lcd(i2c_disp); |
andcor02 | 5:1fca2683ae6f | 12 | |
KStefan | 9:a4a4f8cc4019 | 13 | int count_o, count_b, count_g = 0; |
andcor02 | 0:80032665d37e | 14 | |
andcor02 | 0:80032665d37e | 15 | int main() |
andcor02 | 0:80032665d37e | 16 | { |
KStefan | 9:a4a4f8cc4019 | 17 | lcd.printf(0, "Red Blue Green\r"); // Parameter von printf auf LCD: Zeilennummer (0 or 1), string |
KStefan | 9:a4a4f8cc4019 | 18 | while(1) { |
KStefan | 8:0f74264cc38a | 19 | |
KStefan | 10:f727c310c86f | 20 | lcd.printf( 1, "%d %d %d", count_o, count_b, count_g); |
KStefan | 8:0f74264cc38a | 21 | |
KStefan | 8:0f74264cc38a | 22 | myled = !myled; |
KStefan | 9:a4a4f8cc4019 | 23 | |
andcor02 | 0:80032665d37e | 24 | } |
andcor02 | 2:587b4d7444d1 | 25 | } |