E embedded Active Member Licensed User Longtime User May 30, 2023 #1 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. [CODE lang="b4x" title="Reset through Inline C" highlight="Reset Arduino UNO"] 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[/CODE]
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. [CODE lang="b4x" title="Reset through Inline C" highlight="Reset Arduino UNO"] 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[/CODE]
Erel B4X founder Staff member Licensed User Longtime User May 30, 2023 #2 Code: #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? Upvote 1
Code: #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?
E embedded Active Member Licensed User Longtime User May 30, 2023 #3 Erel said: Code: #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? Click to expand... Thanks...EREL...After Running the above code.....Reset is not done...."after reset" is printed in output. Not working for desired result. Upvote 0
Erel said: Code: #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? Click to expand... Thanks...EREL...After Running the above code.....Reset is not done...."after reset" is printed in output. Not working for desired result.
Erel B4X founder Staff member Licensed User Longtime User May 31, 2023 #4 It should be something like: Code: #if C void(* resetFunc) (void) = 0; void Reset (B4R::Object* o) { //lower case variables Serial.println("going to reset"); delay(2000); resetFunc(); } #End if Upvote 0
It should be something like: Code: #if C void(* resetFunc) (void) = 0; void Reset (B4R::Object* o) { //lower case variables Serial.println("going to reset"); delay(2000); resetFunc(); } #End if
E embedded Active Member Licensed User Longtime User May 31, 2023 #5 Erel said: It should be something like: Code: #if C void(* resetFunc) (void) = 0; void Reset (B4R::Object* o) { //lower case variables Serial.println("going to reset"); delay(2000); resetFunc(); } #End if Click to expand... Bingo....It works smoothly...Thank You EREL...You are Genius.... Upvote 0
Erel said: It should be something like: Code: #if C void(* resetFunc) (void) = 0; void Reset (B4R::Object* o) { //lower case variables Serial.println("going to reset"); delay(2000); resetFunc(); } #End if Click to expand... Bingo....It works smoothly...Thank You EREL...You are Genius....