Bluetooth Serial Print Code

I am working on with a Arduino Bluetooth to make it send a analog reading to a android device. I cant make the code work. Here is my code, Please look it through and tell me what im doing wrong.

Possible string values: a (to turn the LED on) b (tor turn the LED off) */

char junk; String inputString="";

void setup() // run once, when the sketch starts { Serial.begin(9600); // set the baud rate to 9600, same should be of your Serial Monitor pinMode(13, OUTPUT); analogRead(0) ; }

void loop() { if(Serial.available()){ while(Serial.available()) { char inChar = (char); //read the input inputString += inChar; //make a string of the characters coming on serial } Serial.println(inputString); while (Serial.available() > 0) { junk = ; } // clear the serial buffer if(inputString == "a"){ //in case of 'a' turn the LED on digitalWrite(13, HIGH); }else if(inputString == "b"){ //incase of 'b' turn the LED off digitalWrite(13, LOW); } {analogRead(0); Serial.print; { inputString = ""; } } }

Please tell us more about your trouble and before posting please read how to use this forum section

Tyruswoll: send a analog reading to a android device.

The first thing you have to do is make a firm decision about what you want to do, and then use code that is appropriate for that purpose.

You state that you want to send a reading to the phone, i.e. Arduino > Android. The code you post is for controlling an LED from the phone i.e. Android > Arduino.

This code is probably kosher for its purpose, but will never work for what you want. If you are already able to send your analogue reads to the serial monitor, you already have the code you really need. You simply disconnect the monitor, connect bluetooth, and acquire the data on the phone with a standard terminal programme, like BlueTerm

You might find the following background notes useful

    Serial.print; {
    inputString = "";

You don't know what the f**k you're doing, do you?