Nefarious19
New Member
Hello Guys,
I tried to compile code below to use other hardware uarts on my Arduino boards but i get an error. Can you explain wthat i'm doing wrong? Thank you in advance for help.
ERROR:
I tried to compile code below to use other hardware uarts on my Arduino boards but i get an error. Can you explain wthat i'm doing wrong? Thank you in advance for help.
B4X:
#Region Project Attributes
#AutoFlushLogs: True
#CheckArrayBounds: True
#StackBufferSize: 300
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'Public variables can be accessed from all modules.
Public SerialNative1 As Stream
End Sub
Private Sub AppStart
RunNative("SerialNative1", Null)
End Sub
#if C
void SerialNative1(B4R::Object* unused)
{
::Serial1.begin(9600); //<--You can change the baud rate
b4r_main::_serialnative1->wrappedStream = &::Serial1;
}
#end if
ERROR:
B4X:
B4R version: 1.80
Parsing code. (0.00s)
Compiling code. (0.02s)
Building project (0.03s)
Compiling & deploying Ino project (Arduino Nano - COM7) Error
Loading configuration...
Initializing packages...
Preparing boards...
Verifying...
sketch\b4r_main.cpp: In function 'void SerialNative1(B4R::Object*)':
b4r_main.cpp:9: error: '::Serial1' has not been declared
::Serial1.begin(9600); //<--You can change the baud rate
^
b4r_main.cpp:10: error: '::Serial1' has not been declared
b4r_main::_serialnative1->wrappedStream = &::Serial1;
^
exit status 1