• Arduino AND Bluetooth HC-05 Connecting easily

    so this code below will allow me to communicate to the arduino mega via blue tooth with android, //SoftwareSerial Serial1(10, 11); // RX, TXint ledpin=13; // led on D13 will show blink on / offint BluetoothData; // the data given from Computervoid setup() { // put your setup code here, to run once: Serial1.begin(9600); Serial1.println("Bluetooth On please press 1 or 0 blink LED .."); pinMode(ledpin,OUTPUT);}void loop() { // put your main code here, to run repeatedly: if (Serial1.available()){BluetoothData=Serial1.read(); if(BluetoothData=='1'){ // if number 1 pressed .... digitalWrite(ledpin,1); Serial1.println("LED On D13 ON ! "); } if (BluetoothData=='0'){// if number 0 pressed .... digitalWrite(ledpin,0); Serial1.println("LED On D13 Off ! "); }}delay(100);// prepare for next data ...}

    View Instructable »