B4R Question How to Reset Arduino Uno Through Program or Inline C

embedded

Active Member
Licensed User
Longtime User
In Arduino IDE There is a function

void(* resetFunc) (void) = 0;

Which Reset the the Uno through Software. it is working. Now I am trying to implement in B4R Through linline C....But unable to reset it. Please help.


Reset through Inline C:
Sub Process_Globals
    Public Ser1 As Serial
    Public mystream As AsyncStreams
    Public bc As ByteConverter
    Public receivedata As Int
    Dim count As Byte
End Sub

Private Sub AppStart
    Ser1.Initialize(115200)
    Log("AppStart")
    
    
     RunNative("Reset",Null)
End Sub





#if C
void Reset (B4R::Object* o) {
   //lower case variables
   Serial.println("going to reset");
   delay(2000);
   void(* resetFunc) (void) = 0;
  
}
#End if
 

embedded

Active Member
Licensed User
Longtime User
B4X:
#if C
void Reset (B4R::Object* o) {
   //lower case variables
Serial.println("going to reset");
   delay(2000);
   void(* resetFunc) (void) = 0;
   Serial.println("after reset");
}
#End if
What do you see with this code?
Thanks...EREL...After Running the above code.....Reset is not done...."after reset" is printed in output. Not working for desired result.
 
Upvote 0

embedded

Active Member
Licensed User
Longtime User
It should be something like:
B4X:
#if C
 void(* resetFunc) (void) = 0;
void Reset (B4R::Object* o) {
   //lower case variables
   Serial.println("going to reset");
   delay(2000);
resetFunc();

 
}
#End if
Bingo....It works smoothly...Thank You EREL...You are Genius....
 
Upvote 0
Top