Code-Basis für Programm zum Taster-Entprellen
Fork of Laser-Distance by
main.cpp@4:ef7abafa9884, 2017-11-02 (annotated)
- Committer:
- andcor02
- Date:
- Thu Nov 02 10:55:17 2017 +0000
- Revision:
- 4:ef7abafa9884
- Parent:
- 3:1ed9495c9158
- Child:
- 5:1fca2683ae6f
Sets up LCD and prints sensor data value of MMA7660 accelerometer sensor to LCD
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andcor02 | 0:80032665d37e | 1 | #include "mbed.h" |
andcor02 | 0:80032665d37e | 2 | #include "C12832.h" |
andcor02 | 4:ef7abafa9884 | 3 | #include "MMA7660.h" |
andcor02 | 0:80032665d37e | 4 | |
andcor02 | 0:80032665d37e | 5 | /* Sets up LCD and prints sensor data value of Indoor Air Quality sensor to LCD */ |
andcor02 | 0:80032665d37e | 6 | |
andcor02 | 0:80032665d37e | 7 | C12832 lcd(PE_14, PE_12, PD_12, PD_11, PE_9); //LCD: MOSI, SCK, RESET, A0, nCS |
andcor02 | 4:ef7abafa9884 | 8 | MMA7660 MMA(PF_0, PF_1); //ACCELEROMETER: I2C_SDA, I2C_SCL |
andcor02 | 0:80032665d37e | 9 | |
andcor02 | 0:80032665d37e | 10 | int main() |
andcor02 | 0:80032665d37e | 11 | { |
andcor02 | 0:80032665d37e | 12 | while(1) { |
andcor02 | 3:1ed9495c9158 | 13 | lcd.cls(); |
andcor02 | 0:80032665d37e | 14 | lcd.locate(0,3); |
andcor02 | 4:ef7abafa9884 | 15 | lcd.printf("[ACCEL]"); |
andcor02 | 3:1ed9495c9158 | 16 | lcd.locate(0,14); |
andcor02 | 4:ef7abafa9884 | 17 | lcd.printf("x=%.2f y=%.2f z=%.2f",MMA.x(), MMA.y(), MMA.z()); // Print to LCD values |
andcor02 | 4:ef7abafa9884 | 18 | wait(1); |
andcor02 | 0:80032665d37e | 19 | } |
andcor02 | 2:587b4d7444d1 | 20 | } |