Skip to main content
Tan Wen
Visitor II
August 18, 2018
Question

I would like to ask about the stm32f103c8t6 mircocontroller. I am using this mircocontroller to program a drone using arduino.

  • August 18, 2018
  • 2 replies
  • 564 views

I using bluetooth to control the drone by sending single character. But when i press the button on my phone, they is nothing happen on the drone. So, i think that my arduino coding is not complete yet.....

Below is my coding:

#define M1_PIN   PA8

#define M2_PIN   PA7

#define M3_PIN   PA6

#define M4_PIN   PA1

#define tx     PB11

#define rx     PB10

char blue = 0;

String readb;

void setup() {

 pinMode(M1_PIN, OUTPUT);

 pinMode(M2_PIN, OUTPUT);

 pinMode(M3_PIN, OUTPUT);

 pinMode(M4_PIN, OUTPUT);

 Serial.begin(9600);

}

void loop() {

 if(Serial.available()> 0){

  blue = Serial.read();

  readb += blue;

 }

 if(readb == "O"){

   analogWrite(M1_PIN, 65535);

   analogWrite(M2_PIN, 65535);

   analogWrite(M3_PIN, 65535);

   analogWrite(M4_PIN, 65535);

   readb = "";

 }

 else if (readb == "S"){

   analogWrite(M1_PIN, 0);

   analogWrite(M2_PIN, 0);

   analogWrite(M3_PIN, 0);

   analogWrite(M4_PIN, 0);

   delay(5000);

   readb = "";

 }

}

    This topic has been closed for replies.

    2 replies

    T J
    Senior III
    August 19, 2018

    is this MBED ?

    maybe you should use the MBED forum...

    I rarely see any MBED issues questioned here, not sure if anyone is using it on this site.

    Tesla DeLorean
    Guru
    August 19, 2018

    ARDUINO != MBED

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..