cancel
Showing results for 
Search instead for 
Did you mean: 

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

Tan Wen
Associate

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 = "";

 }

}

2 REPLIES 2
T J
Lead

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.

ARDUINO != MBED

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