Hy guys,
So, I have not so many experience... and my question may be very silly...
I just wanto to log data coming out form my CurrentCost energy meter.
I CAN see data coming out from CurrentCost connected to a softwareserial pin RX. Data are clean and readable.
ÿÿÿÿÿÿÿÿÿÿÿÿ 00082
203405CC020285911.0600184000000000025.6
I CAN write some info and run exemple from sdfat.
When I mesh up Serial.print(nameofvariable) and some SD operation (open file or File.print(nameofvariable)) the data came up not readable in terminal and on file. So I DO log the data on a file of the SD, but I cannot read (as human) what I've got.
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ<&åi—?&L02h<?&'?É/* *?Å??OÉ* *?0[“?zÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ<&z?²éXt)ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ<?¬J¹?LaÉ
ÿòÅ^??Á4 ?Id<Ó0??M"ò<Lµ??¦Lòÿÿÿÿÿÿÿ<?âË&“
zÒ&?ÿÅB<â?âÁx?
&¬
“?<&"LÁ?Á0ò^âÿÿÿÿÿÿÿÿ<Lz0“/??O zâ0K+ñ&Á?ùbLâ A
7â¡dâ[å?âââÿÿÿÿÿÿ<â?&Oat?
+ÐBO<?zòÂ"YÅ
?ÿù??Á[ÁòjÊÁ<§zÿÿÿÿÿÿÿÿÿ<O+j.Ízk2òO?
?sMz² ù<Yéòñ??ù"?5z&<?ùâzÿÿÿÿÿÿÿÿ<½Eâââñ<“
ÿ&^ L/`ù'??
M??ÇÉ?
ñÉ
?0âLÁÿÿÿÿÿÿÿ<?
What I'm missing in my sketch:
#include <SdFat.h>
#include <SdFatUtil.h>
#include <SoftwareSerial.h>
Sd2Card card;
SdVolume volume;
SdFile root;
SdFile file;
#define rxPin 4
#define txPin 300
SoftwareSerial softSerial = SoftwareSerial(rxPin,txPin);
void setup(void)
*{ *
-
pinMode(rxPin, INPUT); *
-
pinMode(txPin, OUTPUT);*
-
softSerial.begin(9750);*
-
Serial.begin(9600);*
-
Serial.println();*
-
PgmPrintln("Type any character to start");*
-
while (!Serial.available());*
-
// initialize the SD card*
-
!card.init();*
-
// initialize a FAT volume*
-
!volume.init(card);*
-
// open the root directory*
-
!root.openRoot(volume);*
-
Serial.println();*
-
Serial.println("Done");*
}
void loop(void){
// file.writeError = false;
-
!file.open(root, "CurrCost.log", O_CREAT | O_APPEND | O_WRITE);*
-
char someChar = softSerial.read();*
-
//char someChar = softSerial.read();*
-
Serial.print(someChar);*
-
file.write(someChar);*
-
!file.close() || file.writeError ;*
}
Thanks in advance ;D