
x
main.cpp
- Committer:
- JackB
- Date:
- 2018-07-23
- Revision:
- 0:bce89220fc21
File content as of revision 0:bce89220fc21:
#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); } }