Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* ----------------- Arduino UNO ----------------------- */
- int time_start;
- int time_end;
- void setup() {
- pinMode(LED_BUILTIN, OUTPUT);
- Serial.begin(115200);
- time_start = millis();
- for (int i=0;i < 1e+4; i++)
- {
- digitalWrite(LED_BUILTIN, HIGH);
- digitalWrite(LED_BUILTIN, LOW);
- }
- time_end = millis();
- Serial.print("time_start ");
- Serial.println(time_start);
- Serial.print("time_end ");
- Serial.println(time_end);
- Serial.print("Result ");
- Serial.println(time_end - time_start);
- }
- void loop() {
- delay(10);
- }
- /* Result
- time_start 0
- time_end 137
- Result 137
- */
- /* ----------------- Arduino UNO ----------------------- */
- /* ----------------- STM32 Nucleo-64-F446RE 16MHz ------ */
- //Retargert USART2:
- int _write(int fd, char* buff, int len)
- {
- if (HAL_UART_Transmit(&huart2, (uint8_t*)buff, len, 100) == HAL_OK)
- return len;
- return 0;
- }
- // main
- /* Infinite loop */
- /* USER CODE BEGIN WHILE */
- printf("Hi There!\n");
- uint32_t time_start, time_end;
- time_start = HAL_GetTick();
- for (int i = 0; i < 1e+4; i++) {
- HAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, GPIO_PIN_SET);
- HAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, GPIO_PIN_RESET);
- }
- time_end = HAL_GetTick();
- printf("Start: %lu\n", time_start);
- printf("End: %lu\n", time_end);
- printf("Total: %lu\n", time_end - time_start);
- while (1)
- { ...
- /*
- Hi There!
- Start: 1
- End: 89
- Total: 88
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement