Stefan Kummer
/
Laser-Distance
#1
Fork of mbed-cloud-connect-sensor-laser-distance by
main.cpp
- Committer:
- KStefan
- Date:
- 2018-12-10
- Revision:
- 9:f2bdb2a79528
- Parent:
- 8:0f74264cc38a
File content as of revision 9:f2bdb2a79528:
#include "mbed.h" #include "SB1602E.h" #define USE_I2C_2V8 #include "DebounceIn.h" DigitalOut myled(P0_8); // 7=rot, 8=grün, 9=blau DigitalIn sw_o(P0_12); InterruptIn sw_b(P0_13); InterruptIn sw_g(P0_14); Ticker ticker1; I2C i2c_disp(P0_5, P0_4); // SDA, SCL auf LPC11U24 SB1602E lcd(i2c_disp); int count_o, count_b, count_g = 0; void blue(){ count_b++; } void green() { count_g++; } int main() { lcd.printf(0, "Red Blue Green\r"); // Parameter von printf auf LCD: Zeilennummer (0 or 1), string while(1) { lcd.printf(1,1, "%d %d %d", count_o, count_b, count_g); myled = !myled; } }