chipKIT® Development Platform

Inspired by Arduino™

ChipKit Max32 with Bluesmirf received value as 0

Created Tue, 07 Jul 2015 17:09:06 +0000 by rgkrishnas


rgkrishnas

Tue, 07 Jul 2015 17:09:06 +0000

Hello,

I did some project using Arduino Board & bluetooth module and i am able to pass value from my mobile application. I am trying to do the same thing with ChipKit Max32 with a Bluesmirf module, signals are passing from Mobile to ChipKit, but the values are received as 0 for all inputs.

Below is my code:

//Correct code for Light on off button function //

#include <SoftwareSerial.h>

SoftwareSerial mySerial(19, 18); 
int dataFromBT;

void setup() {
  Serial.begin(9600); // 9600 is working in Arduino
  Serial.println("LEDOnOff Starting...");

  // The data rate for the SoftwareSerial port needs to 
  // match the data rate for your bluetooth board.
 //    mySerial.begin(115200); //
   mySerial.begin(9600);

}

void loop() {

  if (mySerial.available()) {
    dataFromBT = mySerial.read();
      Serial.println("Main Value for dataFromBT is ");
         Serial.println(dataFromBT);

   }
  if (dataFromBT > 0) {
   Serial.println("Value for dataFromBT is ");
   Serial.println(dataFromBT);
  }
  
}

Could anybody help me on this or share some useful doc for ChipKit max32 with bluetooth module code.


majenko

Tue, 07 Jul 2015 23:17:17 +0000

The MAX32 has many hardware serial ports. There really is no call to be using the ropey old SoftwareSerial (that barely works at the best of times). Switch to using one of the many UART ports (as detailed in the manual) and you may have more joy.