It's a radar sensor project, what I want to do is make arduino pro receive analog data from A3, converts to digital data, then transmit to laptop through bluetooth. I have ADC code like this:
int analogPin = 3;
int val = 0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
val = analogRead(analogPin);
Serial.println(val,DEC);
}
And I have a bluetooth example code like this:
#include <SoftwareSerial.h>
int bluetoothTx = 2; // TX-O pin of bluetooth mate, Arduino D2
int bluetoothRx = 3; // RX-I pin of bluetooth mate, Arduino D3
SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);
void setup()
{
Serial.begin(9600);
bluetooth.begin(9600);
}
void loop()
{
if(bluetooth.available())
{
Serial.print((char)bluetooth.read());
}
if(Serial.available())
{
bluetooth.print((char)Serial.read());
}
}
The problem is I don't know how to combine them together =( =(
Can anyone one teach me how to program the board so that it can receive data from A3, and transmit through D3 with bluetooth?