Threads in LC

Rick Harrison harrison at all-auctions.com
Sat Jan 2 17:00:18 EST 2021


Hi Jerry,

1 millisecond is probably asking too much of LC.
It doesn’t give an LC processor enough time to do 
much of anything else and I can see why just
moving the mouse would affect the speed of the
motor.  I’m assuming that what you really want
is a steady rate for the motor rather than a
variable one.

Try some experiments with increasing the amount
of time in-between motor steps if you can.  You may
find a balance somewhere that is acceptable.

I also found this comparison of Banana Pi Vs. Raspberry Pi 3
which you may also find useful.

Good luck!

Rick

Banana Pi M3 Vs Raspberry Pi 3 Benchmark

Aspects	Banana Pi M3	Raspberry Pi 3
Processor	ARM V7 Cortex A7	ARM V8 Cortex A53
Frequency	1.8GHz	1.2GHz
CPU Cores	8	4
RAM	2GB DDR3	1GB DDR2
SoC	A83T	BCM2837
Storage	Micro SD/USB SATA 2.0	Micro SD <https://www.raspberrypistarterkits.com/accessories/top-micro-sd-cards-raspberry-pi/>
Onboard Storage	8GB eMMC	No
GPU	PowerVR SGX544MP	Broadcom VideoCore IV
GPU Speed	700MHz	400MHz
GPIO Pins	40	40
USB 2.0	2 + 1 OTG	4
Power <https://www.raspberrypistarterkits.com/accessories/best-raspberry-pi-power-supply/>	5V 2A	5V 2.5A


> On Jan 1, 2021, at 11:20 AM, JeeJeeStudio via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> Hi Rick,
> 
> thanks fo responding.
> 
> It's a Pi 3 model B+, should be fast enough for this simple task.
> 
> on clockWise
>     -------------------------steps between pos and wait----------------
>       repeat for sStp times --clockwise
>                      Pi_gpio_output 20, 0 --dir
>           Pi_gpio_output 21, 1 --step
>           wait sSpd milliseconds with messages
>           Pi_gpio_output 21, 0
>           wait sSpd milliseconds with messages
>     if the mouse is down
>           then
>              Pi_gpio_output 21, 0 --step
>              set the label of me to "Start"
>           exit repeat
>        end if
>     end repeat
> end clockWise
> 
> The time between a 1 and a 0 on the output is 1ms. I can lower the speed and thus increase time, but that does not matter.
> 
> I think I tried it once with send in time, not a succes. So maybe i have to rewrite that with a different mindsetting. I don't have all stack with me at the moment.
> 
> The above piece is from an older stack, but the last is similar.
> 
> Also the wait shall not be the most convenient wait to handle this.
> 
> It also has of course an counterClockwise handler which is similar, but then output 20 is a 1.
> 
> it should run for so many steps, then wait a few seconds and then return. If there is one position. If there are more positions, it should go to those positions too with eqaul steps, then wait on each position, then return those same positions to the start.
> 
> It all works, but due to the single thread, moving the mouse, it interferes. So in fact LC is to heavy for a single thread. Guess we would win speed if we got multi-thread. Not just for Raspberry.
> 
> Then there is still max LC7.0 for Rasp, so a port to that should also be made.
> 
> Thanks.
> 
> Jerry
> 
> 




More information about the use-livecode mailing list