B4R Question ESPUI trouble: MCU is loop rebooted - peacemaker    
Sep 2, 2024HI, All
Strange, but i'm using few controls on a web-page of ESPUI, but the MCU is rebooted som...
link: Sorry, i am travelling, i cannot help you...
Juste, ESPUI was install with Arduino 4 and all needed ...
link: @candide
What are dependencies lib versions do you have installed in Arduino ?
AsyncTCP and ESPAsync...
link: if i lock others.restart(2) no crash, but i don't find what is other......
B4R Code Snippet SD-card: save log into a limited (looped) log file - peacemaker    
Aug 25, 2024Right logging system must not be overloaded by the log files amount.
So, if the storage is limited - any logging must be looped.
The system log file name is hardcoded, the max file size also... (i do not prefer to make a custom class from the standard one), so the looping is made by the file... Sub
Sub Add_Looped_Log(line() As Byte) As Boolean
Return RunNative("looped_log"...());
}
B4R::Object* looped_log(B4R::Object* o){
B4R::Array* b = (B4R::Array*)B4R::Object::toPointer(o...
Bug? For Each Loop - Daestrum    
Mar 12, 2021The For Each loop over an array of strings appears to be stopping one short (plus corruption...
Log(ss)
Next
Log("*** for loop ***")
For tmp = 0 To returnStrings.Length - 1...
link: Returning an array of strings from a sub is not supported. The compiler should have thrown an error....
link: Strings are not recomended in B4R due to memory handling issues. The recommended way (if I'm no...
link:
..
Try this:
Log("*** test for each String ***")
Dim arrString() As String = re...
B4R Question Proper way to do this loop - ESP-12E (ESP2866) - Robert Valentino    
Dec 18, 2019 just to the AddListener routine but it seems to miss these pushes when in this loop
Is there a way to... routine gets call?
When I am not in this loop I get the push button interrupts just fine.
Private...
link: I've since uploaded an example of what I am trying to do: https://www.b4x.com/android/forum/for...
link: Wish there was a way of calling Code Module routine from a main.
Use a code module or even a class, ...
link: Stopped doing each color individually using ShowColor routine (updated zip file)...
B4R Question stoped on "for each" loop - Tayfur    
Jul 9, 2019 code with like under below. and it stoped on "for each" loop
it s not contiune...
link: It should look like this:
For Each s() As Byte In bc.Split(Buffer, "&")
DoSomething(...
link: Another possible (and better) solution is to move all the loop inner code to a different sub...
B4R Question pause loop every 'n' counts - Mostez    
Mar 17, 2019Hello,
I have this loop, which sends data from SD card to serial stream, I would like to pause the loop for about 100 ms - every 10 K bytes of data(at 10 K, 20 ,30K etc..), to let the other device...
counter = counter + read
' I Want to pause the loop 100ms here every 10k, before...
link: Thanks Erel...
link: If you are not worried about blocking the program while it waits then use:
If Counter > Target Then
Delay(100)
Target = Target ...
B4R Question Exit from loop stops timer! - Mostez    
Dec 24, 2016Hello,
I have a function with do-while loop that reads lines from SD card file then send it to..., but if this function returns false the time completely stops(timer temporarily stops when loop runs...
link: .SubString2 is not used in loop anymore. so any other function inside the loop will make it unstable...
link: stable, it is just gone crazy when I call that loop
Sub PutString(x As Byte, y As Byte, PrnString...
link: PutString in the while loop.
2. What is PutString?
It is not possible to reset the stack however...
B4R Question loop, timeout and AsyncStreams - Mostez    
Sep 7, 2016Hello,
in B4R code (Arduino Mega) there is a loop check for a counter to reach count i.e. 10, before calling loop I enabled a timer to start the count to break the loop (calculate timeout). at the same time there is an AsyncStreams sub receiving data from serial device. the question is, do these two methods conflict to each other, and what is the best method to handle timeout (for example wait...
link: Subs can never "conflict" with each other as the program is executed by a single thread. Only after one sub completes can a different sub start....
B4R Question AppStart Endless Loop? - rwblinn    
May 7, 2016Hi,
when running this example using B4R BETA 9, the log shows an endless loop logging "appstart - appstart completed".
Any idea what is wrong in the code?
Sub Process_Globals
Public Serial1 As Serial
Public AStream As AsyncStreams
Public StreamS As Stream
Private timer1 As Timer
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart"...
link: You haven't set StreamS so the program crashes when it tries to write to the stream and restarts.
If you want to write to the serial port then you need to add:
StreamS = Serial1.Stream
'or be...
B4R Tutorial Timers, Loopers and CallSubPlus - Erel    
Jan 8, 2017   
(19 reactions)Arduino C example #1:
void setup() {
pinMode(13, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage...
Internally the single thread runs in a loop and manages a messages queue.
You can use AddLooper keyword to set a sub that will be called on each internal loop. This is similar to a timer that runs... that will run each loop.
If you find yourself calling AddLooper and then calling Delay in the "looper...
Page: 1  
2  
3  
4  
5  
6  
7