I am currently working on a project that involves transmitting data wirelessly through inductive coupling. I've attached the schematics below.
Not included in the schematics is a 10k pulldown resistor from the 3.3V voltage regulator on the receiving circuit.
I've also attached a picture showing the waveform from the voltage regulator. This shows that the carrier wave is demodulated... I just need a receiving program that can read the message being sent.
Have receive processor’s Tx pin connected to PC via FTDI Basic or equivalent set at 9600, with receive circuit connected to processor’s Rx pin.
This could work I think:
byte x = 0;
byte y = 0;
void setup(){
Serial.begin(300);
}
void loop(){
if (Serial.available()>0){
byte dataArray[x] = Serial.read();
if (dataArray[x-1] =="!"){
Serial.begin(9600);
for (y=0; y<x; y=y+1){
Serial.print ([dataArray[y]);
}
Serial.println("");
Serial.begin(300);
x=0;
}
x=x+1;
}
}
CrossRoads:
Have receive processor’s Tx pin connected to PC via FTDI Basic or equivalent set at 9600, with receive circuit connected to processor’s Rx pin.
This could work I think:
byte x = 0;
byte y = 0;
void setup(){
Serial.begin(300);
}
void loop(){
if (Serial.available()>0){
byte dataArray = Serial.read();
if (dataArray[x-1] =="!"){
Serial.begin(9600);
for (y=0; y<x; y=y+1){
Serial.print ([dataArray[y]);
}
Serial.println("");
Serial.begin(300);
x=0;
}
x=x+1;
}
}
There seems to be an error in compiling the program, I’ve pasted the log below.
TestSerial.ino: In function ‘void loop()’:
TestSerial.ino:9:37: error: variable-sized object ‘dataArray’ may not be initialized
TestSerial.ino:10:26: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
TestSerial.ino:13:33: error: expected ‘,’ before ‘[’ token
TestSerial.ino:13:33: error: expected identifier before ‘[’ token
TestSerial.ino:13:37: error: expected ‘]’ before ‘;’ token
TestSerial.ino: In lambda function:
TestSerial.ino:13:37: error: expected ‘{’ before ‘;’ token
TestSerial.ino: In function ‘void loop()’:
TestSerial.ino:13:37: error: expected ‘)’ before ‘;’ token
Error compiling.