Jack Hansdampf
/
STM32F103C8T_Test1
main.cpp@0:72a15be0e909, 2021-08-14 (annotated)
- Committer:
- jack1930
- Date:
- Sat Aug 14 13:47:23 2021 +0000
- Revision:
- 0:72a15be0e909
STM32F103C8T Mini Modul
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jack1930 | 0:72a15be0e909 | 1 | /* mbed Microcontroller Library |
jack1930 | 0:72a15be0e909 | 2 | * Copyright (c) 2019 ARM Limited |
jack1930 | 0:72a15be0e909 | 3 | * SPDX-License-Identifier: Apache-2.0 |
jack1930 | 0:72a15be0e909 | 4 | */ |
jack1930 | 0:72a15be0e909 | 5 | |
jack1930 | 0:72a15be0e909 | 6 | #include "mbed.h" |
jack1930 | 0:72a15be0e909 | 7 | #include "platform/mbed_thread.h" |
jack1930 | 0:72a15be0e909 | 8 | #include "LCD.h" |
jack1930 | 0:72a15be0e909 | 9 | |
jack1930 | 0:72a15be0e909 | 10 | // Blinking rate in milliseconds |
jack1930 | 0:72a15be0e909 | 11 | #define BLINKING_RATE_MS 500 |
jack1930 | 0:72a15be0e909 | 12 | |
jack1930 | 0:72a15be0e909 | 13 | lcd mylcd; |
jack1930 | 0:72a15be0e909 | 14 | |
jack1930 | 0:72a15be0e909 | 15 | int main() |
jack1930 | 0:72a15be0e909 | 16 | { |
jack1930 | 0:72a15be0e909 | 17 | // Initialise the digital pin LED1 as an output |
jack1930 | 0:72a15be0e909 | 18 | DigitalOut led(PC_13); |
jack1930 | 0:72a15be0e909 | 19 | PortOut leds(PortB,0xF); |
jack1930 | 0:72a15be0e909 | 20 | PortIn dips(PortB,0xF0); |
jack1930 | 0:72a15be0e909 | 21 | DigitalOut pb2(PB_2); |
jack1930 | 0:72a15be0e909 | 22 | DigitalOut pb8(PB_8); |
jack1930 | 0:72a15be0e909 | 23 | mylcd.clear(); |
jack1930 | 0:72a15be0e909 | 24 | mylcd.cursorpos(0); |
jack1930 | 0:72a15be0e909 | 25 | mylcd.printf("Hallo welt"); |
jack1930 | 0:72a15be0e909 | 26 | while (true) { |
jack1930 | 0:72a15be0e909 | 27 | led = !led; |
jack1930 | 0:72a15be0e909 | 28 | leds=dips>>4; |
jack1930 | 0:72a15be0e909 | 29 | mylcd.cursorpos(0x40); |
jack1930 | 0:72a15be0e909 | 30 | mylcd.printf("%2X",leds+dips); |
jack1930 | 0:72a15be0e909 | 31 | pb8=pb2; //GPIOB Bit 2 => Bit 8 |
jack1930 | 0:72a15be0e909 | 32 | thread_sleep_for(BLINKING_RATE_MS); |
jack1930 | 0:72a15be0e909 | 33 | } |
jack1930 | 0:72a15be0e909 | 34 | } |