Hi to all
Im new in this forum.
My knowledge in arduino are little.I have make small and basic projects.
I have start a new project and im not getting well because i find too less informations about it.
i have a depth sensor ATT-120AT http://www.cruzpro.co.nz/active.html
sensor output NMEA code like
$SDDBT,015.7,f,004.8,M,002.6,F*0D <-- depth in feet, meters and fathoms
$SDDPT,004.8,*75 <--- depth in meters only
im intresting read meters output.
I have connect red wire to 12volt +
green wire to pin Rx 0
and third wire to ground 12volt and arduino ground.
i have tryied 1 -2 code samples but have no results.
I would appreciate any help with the code.
thank you
It looks, by the information in the link, like the output is RS232. RS232 voltage levels are not compatible with the Arduino and in fact may damage the RX input. You will need a level converter like the MAX232 or 233 to change the RS232 levels to TTL for the Arduino serial port.
thanks for replay
when i test it with polymeter,voltage was 2-3.5 volt in green wire.and when i google it ,saw that pin 2 in rs232 take 5 volt.do you think converter is necessary?
I don't know for sure if the converter is necessary. What I was going by was that, in the connection diagrams, it says to connect to a computer RS232 port. A real RS232 port can have levels of + and - 15 volts.
I take your advise and use converter.
thanks a lot.
I tryed the SoftwareSerial
#include <SoftwareSerial.h>
SoftwareSerial depthSerial = SoftwareSerial(8,7,true);
void setup() {
Serial.begin(9600);
depthSerial.begin(4800);
}
void loop (){
if (depthSerial.available()>0) {
Serial.write(depthSerial.read());
}
}
and came up with this data

Now i would like to grab the the number from the line start $SDDPT and take it in a variable ($SDDPT,001.1,*79)
any ideas?
I store serial data to a string
void loop (){
char c;
if (depthSerial.available()>0) {
c= depthSerial.read();
Data come with this form
$SDDPT,0.9,70,
$SDDBT,3.2,f,0.9,M,0.5,F0B,
$SDMTW,28.8,C*06,
i would like to take the number after "$SDDPT"
come on guys ,
i know its easy for most of you,i have tried all.
thanks
I have tryed this code for new start, but recieving "variable-sized object RFin_bytes
may not be initialized"
anyone can help
#include <SoftwareSerial.h>
SoftwareSerial depthSerial = SoftwareSerial(0,1,true);
void setup() {
Serial.begin(9600);
depthSerial.begin(4800);
}
void loop (){
while (Serial.available()<6) {} // Wait 'till there are 9 Bytes waiting
for(int n=0; n<6; n++)
char RFin_bytes[n] = Serial.read(); // Then: Get them.
}
Still trying
#include <SoftwareSerial.h>
SoftwareSerial depthSerial = SoftwareSerial(0,1,true);
char got1[7]="";
char look[7]="$SDDPT";
void setup() {
Serial.begin(9600);
depthSerial.begin(4800);
}
void loop (){
int i=i++;
if (depthSerial.available()>0) {
int c=(depthSerial.read());
[color=yellow]char got[i]=c;[/color]
Serial.print(got);
delay(1000);
}
if i=6 & got=look{
for (int x=0;x<5;x++);
char depth[x]=(depthSerial.read());
}
if i=7{
i=0;
}
}
}
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
Arduino: 1.0.6 (Windows 7), Board: "Arduino Duemilanove w/ ATmega328"
readSonarOk.ino: In function 'void loop()':
readSonarOk:18: error: variable-sized object 'got' may not be initialized
readSonarOk:23: error: expected (' before 'i' readSonarOk:27: error: expected
(' before 'i'
readSonarOk.ino: At global scope:
readSonarOk:31: error: expected declaration before '}' token
can you see what wrong?