Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 3 months ago.
stm32f4-discovery. 3 Serial.
This is my mbed project:
include the mbed library with this snippet
#include "mbed.h"
Ticker tickerLed;
//Four user LEDs, LD3 (orange), LD4 (green), LD5 (red) and LD6 (blue)
DigitalOut led3(PD_13,0);
DigitalOut led4(PD_12,0);
DigitalOut led5(PD_14,0);
DigitalOut led6(PD_15);
// Кнопка поиска
//==============================================================================================================
DigitalIn button(PD_10);
//==============================================================================================================
// Последовательный порт
//==============================================================================================================
Serial debug(PB_6,PA_10); // Serial1 tx rx
Serial configBT(PA_2,PA_3); // Serial2 tx rx
//Serial slave(PC_10,PC_11); // Serial3 tx rx
//Serial modem(PA_0,PA_1); // Serial4 tx rx
//==============================================================================================================
void ToggleLed()
{
int tmp;
tmp = led3;
led3 = led4;
led4 = led6;
led6 = led5;
led5 = tmp;
}
int main()
{
bool bStart = false;
led3 = 1;
led5 = 0;
led6 = 0;
led4 = 0;
wait(1.0f);
// Init the ticker with the address of the function (toggle_led) to be attached and the interval (500 ms)
tickerLed.attach(&ToggleLed, 1.0);
while (true)
{
int nBtn = button.read();
if (!nBtn && !bStart)
{
bStart = true;
//debug.printf("v\n");
}
if (nBtn && bStart)
{
bStart = false;
//debug.printf("!\n");
}
}
}
When I uncomment the line "Serial Slave (PC_10, PC_11); 3 Serial TX RX" program does not work. Why serial 3 and serial 4 doesn't work?
What do you mean 'does not work'? Is it hardfaulting? Any error messages on serial?
posted by Jan Jongboom 15 Sep 2016