RaspberryPi Stacks

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3975
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: RaspberryPi Stacks

Post by bn » Fri Jul 18, 2014 12:22 pm

Hi Hermann,

I think it is just a bug, nothing more. It does not make sense to report the thumbpositon as decimal unless one explicitely requests it via numberformat in the inspector.

I reported this as

Bug 12843 - thumposition returns decimal value in LC7 dp6

Kind regards
Bernd

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Wed Oct 22, 2014 1:46 am

Raspberry Pi stacks collection #42 = nixieClock42b.livecode

The main reason for rules is to be able to make exceptions :D

I'm breaking my rules right now here and post a new stack: I'm happy to have LC on Raspberry Pi available. This is a real challenge for me, to write scripts that are fast enough for the Raspi. Here is one of my new stacks (needs some time when starting up but afterwards it takes a back seat in CPU consumption).

I was thinking some time about giving this stack away or not. But after I decided to dedicate a stack to LC's "Mr. Raspi" Fraser Gordon it was clear that only such a beautiful thing (not at all perfect, needs still some fine-tuning later on, but -- in my taste -- beautiful) wood be good enough for such a purpose. Hope you like it.

Fraser, here's to you, and thank you very much for your work!
nixieClock.jpg
The clock shows the local time [HH.MM.SS] or date [DD.MM.YY], buttons to switch are in in top row.
Right click shows a menu of available scaleFactors (20% to 200%).

Currently the stack opens in LC 7 with one "nixieColor" only, because LC 7 needs 8-10 times more time for the startup conversion script than LC 6 (that starts with 6 available nixieColors), you can change this is the script [for example by changing in the evaluation "(char 1 of the version < 7)" the 7 to 8].

Runs on Raspberry Pi fast enough with LC 6.5.1 and later. I like it most when using a TV as display.
[Certainly the stack runs also on other platforms. Startup may take some time. But the nasty jobs are done then.]

Edit. If you wish to have 6 different "colors" for the clock also in LC version 7/8/9 then change in the card's script the handler "siwtchNixieColor" as follows.

Code: Select all

on switchNixieColor
  if ndata is empty then putnixies true
  put nixieColor into nc
  add 1 to nc; if nc>6 then put 1 into nc
  put nc into nixieColor
  put ("ndata"& nc) into nn
  do "put" && nn && "into ndata"
  put true into isToUpdate
  if nixieOFF then runNixie
end switchNixieColor
and replace in the card's script "(char 1 of the version < 7)" with true.
Attachments
nixie42b.livecode.zip
(189.35 KiB) Downloaded 718 times
Last edited by [-hh] on Fri Jan 27, 2017 5:44 pm, edited 3 times in total.
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Fri Oct 24, 2014 2:05 am

Raspberry Pi stacks collection #43 = glowText2b.livecode

This is one of the famous "little stacks" by Bernd (bn).
We had recently a dialog about "glowing text" after he saw the nixieClock (#42) and this here is the result (he somewhat polished and added a "neon-flickering"). Hopefully some other little stacks will follow ...

The stack displays a few lines of "glowing text" by using graphic-effect-properties of the field.
Of course you can have more lines by adjusting the textSize. First of all you will look for a good looking textFont of your taste on your machine (for example by choosing the pointer tool, selecting the field and choosing the textFont from LC's Text menu).

The image below uses the font "Comfortaa" (I found on my Raspi).
glowText2b.jpg
glowText (obviously) running on Raspberry Pi
glowText2b.jpg (10.16 KiB) Viewed 21122 times
Runs on Raspberry Pi fast enough with LC 6.5.1 and later [and also on other platforms.]

[Edit. Sets now backdrop to none on startup to avoid the "Linux-backdrop-bug" on Raspi.]
Attachments
glowText2c.livecode.zip
(3.21 KiB) Downloaded 555 times
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Fri Oct 24, 2014 3:02 pm

Raspberry Pi stacks collection #44 = nuzzler7b.livecode
This stack (or it's scripts) can be used especially with "crashed" LC stacks from any LC version, also from LC 7.0 [For experienced users: It is more than looking on a stack file with a text editor, it tries to extract all scripts from the file.]

A few months ago I wrote a stack that reads (doesn't open with LC) any stack file and extracts everything that looks like a handler into a 'script text field', coloured by a fine script ('colorize' by Wouter Abraham et al. from useList archive).
The stack should read some scripts directly from disk without opening the stack in LC, because I don't like very much to rename (sub-)stacks just for having a short look into them or to open for that purpose a different LC version.

Now I found this could be also a tool
  • to look at downloaded stacks
  • to rescue some scripts from "crashed" stacks, that LC can't open any more.
The advantage of looking into downloaded stacks before opening them is, that it finds also handlers that are not the script of any object; or you see encrypted stuff that may force you to be cautious.

Be sure the matrix will get you!
(That's a joke that appears in the info field, doesn't any harm, can be switched off. I didn't waste time to pull this out, instead I wrote a short help text).

Run info. The stack is fast enough for Raspberry Pi running LC 6.5.1 and later; also runs on all other platforms.
Attachments
nuzzler-7b.jpg
At top right you see the saving LC version of the stackFile, here REV0700
nuzzler_7b.livecode.zip
md5=1874ea1fef535924967b3cfd0f7a20dc
sha1=b1ec1acfe33ef89f2ae521e453e5c1e36a303f72
(24.45 KiB) Downloaded 708 times
shiftLock happens

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9250
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: RaspberryPi Stacks

Post by richmond62 » Fri Oct 31, 2014 3:18 pm

Wow! Useful or what?

Thanks a lot!

LCfraser
Livecode Staff Member
Livecode Staff Member
Posts: 71
Joined: Thu Nov 28, 2013 11:18 am
Contact:

Re: RaspberryPi Stacks

Post by LCfraser » Wed Nov 12, 2014 5:41 pm

It makes me very happy to see people making use of LiveCode on the RaspberryPi. Thanks for your contributions, Hermann!

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Sat Nov 22, 2014 1:20 am

Raspberry Pi stacks collection #45 = polygonies2.livecode

This stack contains very elementary animation scripts. Start with clicking button "M0-M9", varying the speed, then change some or all locations (short help is given).

"Polygony" has several 'hinges' you can act on with the sliders to move its extremities, and you can change its loc on card by dragging. Several buttons save and restore such states.
The "animation" (by button "M0-M9") consists out of moving graphic Polygony to the 10 memorized states in a row, at a selectable speed.
polygonies2.jpg
A "jumping state" (loc on card and extremities) of Polygony
The stack is meant to "learn by doing" , expanding the technique or just to have fun using it or reading and editing scripts.
Attachments
polygonies2.livecode.zip
(5.32 KiB) Downloaded 653 times
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Sat Jul 25, 2015 11:19 pm

Raspberry Pi stacks collection #46 = cursorsAndImages4hh.livecode [Updated]

Tool for creating multicoloured cursors "on the fly" or for icons of buttons (see also stacks #18-19-20 above).

Options are available for transparency of foreground or background.
Maximal cursor sizes (pixels width x height) are currently 32x32 on Win7, 64x64 on Linux/Raspi and 256x256 on Mac.

20 "memory slots" (10 with shiftkey up and 10 with shiftkey down) can be used.
You may also input chars (ascii num 33-255) as "template". The selfmade-font used is close to the famous bitmap "Chicago 12".

A button COPY copies your artwork to the clipboard for use as (cursor) image elsewhere.

Included are two animation scripts using the cursor:
= TimeAndDate (optionkeyDown shows the date)
= PercentFill (10x10 percent rows)

Just play with the stack and its scripts, a short help is included in the stack.

Tested on desktop Mac/Linux/Win with LC 6 and LC 7, especially latest stable versions 6.7.6 and 7.0.6.
Tested on RaspberryPi B+ running latest avaivalable LC 6 (6.5.1) and LC 7 (7.0.4).


Note for this Update: Previous versions had some bugs on Linux/Raspi coming from button type "opaque" and, with LC 7, by use of a variable name "sh" (!).
Attachments
cursorsAndImages4hh.livecode.zip
(26.8 KiB) Downloaded 540 times
cursorsAndImages4hh.jpg
shiftLock happens

SparkOut
Posts: 2834
Joined: Sun Sep 23, 2007 4:58 pm

Re: RaspberryPi Stacks

Post by SparkOut » Sat Jul 25, 2015 11:50 pm

Hermann! So nice to see you here again. Welcome back.

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Mon Jul 27, 2015 10:06 pm

Raspberry Pi stacks collection #47 = pointInShape1.livecode

Note.
It is not hard to compute but not at all trivial to determine for example whether any pixel/point belongs to a (non-regular) polygon or curved shape or not. So this is especially useful if you plan to script a jigsaw puzzle game.

Description.
Click on any pixel of the card's rect. If and only if it belongs to a graphic object then the corresponding graphic is "outlined" (its border becomes red coloured).
= If there is more than one "owner" of this pixel, then the one at top with respect to the layer position is outlined
= This is true independent of the corresponding pixel being transparent or opaque.
= Drag around this top owner object (handler also in the card's script). Dragging doesn't change the layer of the object which thus may become temporary invisible while dragging if you drag below another object).

ShiftClick on any pixel of the card's rect. Then ALL graphic objects who own this pixel are outlined. (Dragging is still restricted to the top one -- you may easily change this by your own).

For example in the attached picture the red circle, which is on top of all surrounding graphics, is outlined for every click in its interior (also its transparent pixels), else it is not outlined. ShiftClick also outlines all other graphics below the circle that own the clickPixel.
With respect to an object's border one should keep in mind, that the border is drawn by default with half of its linesize "outside" the object's "real" border (you may change this by your own).

The main script is around 100 lines, for all type of LC graphics (essentials are commented).
How does this work? Nothing tricky. The ownership of each graphic object for a clicked pixel is simply computed, once again demonstrating the power of math ...


Tested on desktop Mac/Linux/Win with LC 6 and LC 7, especially latest stable versions.
Tested on RaspberryPi B+ running latest avaivalable LC 6 (6.5.1) and LC 7 (7.0.4).
Attachments
pointInShape1.livecode.zip
(7.19 KiB) Downloaded 578 times
pointInShape1.jpg
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Thu Aug 06, 2015 1:25 am

Raspberry Pi stacks collection #48 = calendar-1-3-6-12.livecode

Description.
The stack allows to display a one- or three- or 6- or 12-month calendar. The calendar dates are computed by a LC script (no shell() used), so that you have easily full access to the output layout. Here you can choose Sunday or Monday as start of the week.

Short help, also included in stack.

- The 3-months-display shows the selected month as number two.
- The 6-months-display shows the selected month as number two.
- The 12-months-display shows the selected month as number 5. Thus, if you select "May" for this display, then you get an usual year-display from January to December.
Whenever the current month is a member of the display then it is "colour-inverted" and the current day is underlined.

=1 Cmd-Click/Ctrl-Click calendar window to close stack.
=2 Drag calendar window (outside calendars) to move it around.

=3 Choose SU or MO (at topleft) for start of week.
=4 Btn "layout" lets you choose a 1/3/6/12-month calendar display.
=5 RightClick calendar window to show/hide the preferences group.
=6 Use scrollWheel to go one month forward or backward, or (with capsLock) 12 months.
=7 Use btn "<|" to go back one month or (with capsLock) 12 months.
=8 Use btn "|>" to go forward one month or (with capsLock) 12 months.
=9 Use fld "year" to also adjust the menu to show yr-5 to yr+10

Tested on desktop Mac/Linux/Win with LC 6 and LC 7, especially latest stable versions.
Tested on RaspberryPi B+ running latest available LC 6 (6.5.1) and LC 7 (7.0.4).
Attachments
calendar-1-3-6-12.livecode.zip
(7.47 KiB) Downloaded 533 times
calendar-1-3-6-12.jpg
A 6-month-display, the (draggable and hideable) prefs group at bottomLeft
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Thu Aug 06, 2015 10:35 pm

Raspberry Pi stacks collection #49 = motionWebcam.livecode

Description:
This is a frontend to a special feature of the great linux program "motion". If your OS runs "motion" and is 'sudo-configured' in an appropriate way, you may run it on your machine other than RaspberryPi too.

Short help is included in the stack.

On RaspberryPi, "motion" is installed and configured for our purpose in 15 minutes (instructions are included in the stack help). You use your old simple 10$ USB webcam with a Raspi running Raspbian.

These are the main features:
= Every other second a picture is taken and shown as an image object. We only hold the last one of these 60 in a minute for a slide-show, that is a show of up to 1440 minute-images a day. Saving these files in /tmp removes everything with everu restart (you may adapt this to your needs).
= Moreover, if you have also installed an apache-webserver, you can watch these second-images in a usual browser via http.
= We also do not disable the motion induced creation of avi-files (you may watch them later on with vlc) and nevertheless the installation is fast enough to run with less than 10% CPU-load on a Raspi B+ at 900 MHz, LC needs less than 50 ms per round.

[Note: I tried this also with "fswebcam" (that has no motion detection). The webcam-feture is working fine, has a lot of display options too, but is not fast enough. It needs 2-3 seconds per picture with a short but heavy CPU load,. If this is good enough for you, then fswebcam is an option for you.]

Hint: If you have video problems related to your webcam, install vlc
$ sudo apt-get install vlc
This may solve a lot of problems and is on fast machines also usable for "webcam-streaming" (use "open capture device ..." of menu "File").

Tested to run on RaspberryPi B+ running latest available LC 6 (6.5.1).
Sad to say, LC 7 (7.0.4) crashes immediately (or shows nothing) when setting the filename of an image.
Let us hope for an improved LC 7 version for the Raspi ...


Edit 1.
= The first line of point [5] of the installation help is wrong, should read:
daemon off <-- change to on.
= Tested to run also on Xubuntu 1504 with LC 6 (here LC 7 ignores setting the filename).

Edit 2.
= Tested to run also on RaspberryPi 2 B running latest available LC 6 (6.5.1).
= Goes stable with a CPU load of < 2% @ 800 MHz !!
Attachments
motionWebcam.livecode.zip
(4.28 KiB) Downloaded 495 times
motionWebcam.jpg
At left an image by 'motion' of a 10$ miniDisplay (will be one of next stacks)
Last edited by [-hh] on Thu Aug 13, 2015 8:34 pm, edited 2 times in total.
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Tue Aug 11, 2015 12:03 am

Raspberry Pi stacks collection #50 = dragAndPath.livecode

Description:
This stack provides three features, that I often need (and sometimes missed).

= Drag any stack window by click on "unused" pixels of it, especially if the stack window is partly off the screen or the titlebar is hidden by other objects (for example the LC Toolbar) or has no titlebar at all or is using windowShape.
= Show a "path menu" to the stack's file, in order to know the current "working directory" or to go to a subpath by selecting a path item, for example to the stack's file enclosing folder.
= Show an info about the stackFileVersion and the LC version.

This is done by use of an invisible background group, it goes behind the card as a message receiver. Just copy and paste it.

Short help is included in the stack.

Tested on desktop Mac/Linux/Win with LC 6 and LC 7, especially latest stable versions.
Tested on RaspberryPi B+ running latest avaivalable LC 6 (6.5.1) and LC 7 (7.0.4).
Attachments
dragAndPath.livecode.zip
(13.05 KiB) Downloaded 475 times
dragAndPath1.png
Example contextMenu (RightClick) showing the stack's path menu.
dragAndPath2.png
Example contextMenu (Shift-RightClick) with an info on versions.
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Tue Aug 18, 2015 2:18 pm

Raspberry Pi stacks collection #51 = wheelCursor2e.livecode

Description:
The stack creates a colorWheel (similar to the new Apple system colorWheel of elCapitan 10.11) in sizes 16x16, 32x32,64x64,128x128 and 256x256. You may moreover choose the color for each of the 6 segments of the wheel. Created are graphics by math and then exported by snapshots to images for "cursoring".

Note. Recall that max cursorSizes are 32x32 for Win7, 64x64 for Linux and 256x256 for MacOS. An option button "cursorSize" is adjusted accordingly. Nevertheless all sizes are created when using button "saveImages", so that you can try to use larger sized images and scale them down to your available sizes for possibly better display results.

There is an option to copy the created group of images and a group of buttons (as a demo for running such a wheel animation) to new/other stacks.

Short help is also included in the stack.

On RaspberryPi B+ is creating and saving images (needed once) somewhat slow, on RaspberryPi 2 B much faster and on other desktop machines/CPUs acceptable fast for a lot of testing.

Tested on RaspberryPi B+ and Raspberry 2 B, running latest available LC 6 (6.5.1) and LC 7 (7.0.4).
Tested on desktop Mac/Linux/Win with LC 6 and LC 7, especially latest stable versions (6.7.6 and 7.0.6).


New in this version: A button "backColors" with some predefined color sets, especially colors of some national tricolor flags.
Attachments
wheelCursor2e.livecode.zip
(148.29 KiB) Downloaded 486 times
wheelCursor2e.jpg
At topleft MacOS 10.11 wheel, centered a 128x128 bleu-blanc-rouge (FR)
or rood-wit-blauw (NL) wheel.
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Wed Aug 26, 2015 3:36 pm

Raspberry Pi stacks collection #52 = clockAround1b.livecode

Description.
The stack provides a circular/ analogue 12h or 24h display of time.
  • A lot of display options are choosable from a prefs group and immediately applied.
    (Use button "P" at topLeft.)
  • The clock shows optionally a countDown to next midnight (= backClock).
  • Also a countDown of up to 100 hours can be shown (stack must be running).
    Such a countDown may be paused and be continued later on.
Short help is included in stack (use button "H" at topLeft).

Tested on RaspberryPi B+ and RaspberryPi 2 B, running latest avaivalable LC 6 (6.5.1) and LC 7 (7.0.4).
Tested on desktop Mac/Linux/Win with LC 6 and LC 7, especially latest stable versions (6.7.6 and 7.0.6).
Attachments
clockAround1c.livecode.zip
(9.89 KiB) Downloaded 466 times
clockAround1c.png
A mode that shows circular arcs with ticks, no hands.
shiftLock happens

Post Reply

Return to “Raspberry Pi”