Jack Berkhout
/
20180421_Nucleo_Blink_LED_mbed-os
x
Revision 0:bce89220fc21, committed 2018-07-23
- Comitter:
- JackB
- Date:
- Mon Jul 23 12:37:25 2018 +0000
- Commit message:
- x
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed-os.lib | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r bce89220fc21 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Jul 23 12:37:25 2018 +0000 @@ -0,0 +1,52 @@ +#include "mbed.h" + +#define BAUD_RATE 9600 + +#define LD1_Pin GPIO_PIN_0 +#define LD2_Pin GPIO_PIN_7 +#define LD3_Pin GPIO_PIN_14 + +DigitalOut led1(LED1); +DigitalOut led2(LED2); +DigitalOut led3(LED3); + +Serial pc(USBTX, USBRX); + +int main() { + pc.baud(BAUD_RATE); + printf("\n"); + printf("----------------------------------\n"); + printf("Starting 20180421_Nucleo_blink_led\n"); + printf("" __DATE__ " " __TIME__ "\n"); +#if defined(MBED_MAJOR_VERSION) + printf("Using \033[1;37mMbed OS %d.%d.%d\033[0m\n", MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION); +#else + printf("Using Mbed OS from master.\n"); +#endif + printf("CPU SystemCoreClock: \033[1;37m%d MHz\033[0m\n", SystemCoreClock/1000000); + printf("----------------------------------\n"); + + int number = 0; + while(true) { +// led1 = !led1; +// wait(0.5); + HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0, GPIO_PIN_SET); + HAL_GPIO_WritePin(GPIOB, GPIO_PIN_7, GPIO_PIN_RESET); + HAL_GPIO_WritePin(GPIOB, GPIO_PIN_14, GPIO_PIN_RESET); + HAL_Delay(500); + HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0, GPIO_PIN_RESET); + HAL_GPIO_WritePin(GPIOB, GPIO_PIN_7, GPIO_PIN_SET); + HAL_GPIO_WritePin(GPIOB, GPIO_PIN_14, GPIO_PIN_RESET); + HAL_Delay(500); + HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0, GPIO_PIN_RESET); + HAL_GPIO_WritePin(GPIOB, GPIO_PIN_7, GPIO_PIN_RESET); + HAL_GPIO_WritePin(GPIOB, GPIO_PIN_14, GPIO_PIN_SET); + HAL_Delay(500); + HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0, GPIO_PIN_RESET); + HAL_GPIO_WritePin(GPIOB, GPIO_PIN_7, GPIO_PIN_RESET); + HAL_GPIO_WritePin(GPIOB, GPIO_PIN_14, GPIO_PIN_RESET); + HAL_Delay(500); + printf("%d\n", ++number); + } +} +
diff -r 000000000000 -r bce89220fc21 mbed-os.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Mon Jul 23 12:37:25 2018 +0000 @@ -0,0 +1,1 @@ +https://github.com/ARMmbed/mbed-os/#50bd61a4a72332baa6b1bac6caccb44dc5423309