B4R Question questions about Wire and other

newbie

Member
Licensed User
Longtime User
Hello,

1. question: wire
i have try to transfer the following simple arduino code to B4R:
B4X:
void myRtcGet()
{ byte rSec, rMin, rHour, rDOW, rDay, rMonth, rYear;

  Wire.beginTransmission(DS3231_I2C_ADDRESS);  // Open I2C line in write mode
  Wire.write(0x00);  // Set the register pointer to (0x00)
  Wire.endTransmission();  // End Write Transmission

  Wire.requestFrom(DS3231_I2C_ADDRESS, 7);  // Open the I2C line in send mode

  rSec  = bcdToDec(Wire.read() & 0x7f);  // Read seven bytes of data
  rMin  = bcdToDec(Wire.read());
  rHour  = bcdToDec(Wire.read() & 0x3f); 
  rDOW  = bcdToDec(Wire.read());
  rDay  = bcdToDec(Wire.read());
  rMonth  = bcdToDec(Wire.read());
  rYear  = bcdToDec(Wire.read());
  setTime(rHour,rMin,rSec,rDay,rMonth,rYear);
}
to
B4X:
Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'Public variables can be accessed from all modules.
   Private w1 As WireMaster
   Private w1Adress As Int = 0x68
End Sub

Sub GetClockData
  Log("Init Ds3231")
  w1.Initialize
  w1.WriteTo(w1Adress,Array As Byte(0, 0))
 
  Dim data() As Byte = w1.RequestFrom(w1Adress,7)
  If data.Length = 7 Then
  
  Log("Data:",(data))
  Else
  Log("Missing data...")
    Log("Data:",(data))
  End If
End Sub
Why does it not work , i get no data ????

2. second question: make libraries
i have try erel´s cmdline-code to translate the h-file to xml
no errormessage, no file , what is wrong ??
java -jar B4Rh2xml <c:\Arduino 1.5\libraries\Time\Time.h> <f:\B4R\Additional Libraries\rTime.xml>

thanks for any help
Gerd
 
Last edited:

newbie

Member
Licensed User
Longtime User

--> i will do it
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…