piBeacon: 14- display

Posted on
Wed Oct 26, 2016 11:27 pm
kw123 offline
User avatar
Posts: 5838
Joined: May 12, 2013
Location: Dallas, TX

piBeacon: 14- display

example for showing the sensor BME280 (temp, humidity, pressure) using a 64x32 RGB-LED display
https://www.dropbox.com/s/nku0522vp4rp3re/IMG_0020.m4v?dl=1


example for a small OLED display showing the ultrasound distance info
https://www.dropbox.com/s/q0l56qbq1v0pxqz/IMG_0012.m4v?dl=1


Karl

Posted on
Thu Oct 27, 2016 7:30 am
matt (support) offline
Site Admin
User avatar
Posts: 18617
Joined: Jan 27, 2003
Location: Texas

Re: piBeacon: 14- display

Neat!

Image

Posted on
Thu Oct 27, 2016 8:05 am
DaveL17 offline
User avatar
Posts: 4196
Joined: Aug 20, 2013

Re: piBeacon: 14- display

OK, that's cool.


Sent from my iPhone using Tapatalk

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Thu Oct 27, 2016 2:09 pm
kw123 offline
User avatar
Posts: 5838
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: 14- display

examples of python program to show (a) 4 pages and scroll them through (b) show 2 lines of text and a horizontal bar

you can do the same thing in an action through the menu, use the parameters show here to fill the input fields. They should have the same or similar name as here.


Karl


Code: Select all
### put this into an action script to display text, lines histograms ..
# kw oct 27 2016
####
#
#
### put this into an action script:
# kw oct 27 2016
####
#
#
#
#  parameters:
#  type:          ""/text/line/vbar/hBar/vBarwBox/hBarwBox/point/ellipse/image/hist
#
#  coordinates: top left is x,y=0,0
#               bottom right is x,y = 132,64  or 64,32 for rgb or n*64,32 it you do scrolling (depending on resolution)
#  position     text:     [x,y]
#               line:     [Xs,Ys,Xe,Ye]
#               point:    [[x,y],[x,y],[x,y]]
#               vBar:     [x,y,length]
#               vBarwBox: [Xs,Ys,Length,boxLength]             (width = width of bar)
#               hBar:     [x,y,length]                         (width = width of bar)
#               hBarwBox: [Xs,Ys,Length,boxLength]             (width = width of bar)
#               hist:     [X0,Y0,yMax,Val1,va2,val3,val4,,,]   (width = width of bars); ymax is for end of y axis
#               ellipse:  [Yl,Yl,Xr,Yr]
#               image:    [x,y]   ##you need to send the image file to te rpi by 1. puting into the piBeacon/DisplayFiles folder and then in menu do send soundfonts image files to RPI   
#                                 # it will go into the folder /home/pi/pibeacon/displayfiles 
#
#  fill:         0/255    = bits off/on or 0=inverse for images, default =255
#               [0-255,0-255,0-255] for RGB type display
#
# reset:        ""/0/255 = no display reset/reset to blank/ reset to ON, default ="" --[xx,xx,xx] for rgb
#
# delaytStart:  nn seconds delay before this element is shown, default ="" =0
#
# display:      ""/wait = show/dont show display yet, default = show
#
# width:        ""/0/....99/  =  for fonts: "" or 0 is system font, otherwise ttf font with pts=xx, default =0
#               for vBar, hBar, line vBarwBox/hBarwBox = width of line, default =0, but is 1 point
#
#  scrolling:   scrollxy:    "" =no scrolling ,"left" =scroll left to the end then stop,"right" =..,"left-through" scroll to the end then continue again,"right-through"
#               scrollPages: 1..10  # of pages to be scrolled
#               scrollDelay: 0..x seconds, how much delay between each move, goo speed ~ 0.05 seconds
#              scrollDelayBetweenPages:  wait x seconds between pages  befor continuing scrolling
#
# put text quotes in as:  "  as '\\"' w/o the ' 
#
#
# %%v:abcdef%% will be replaced by the contents of the variable with name abcdef, or id 12345
# %%d:abc:def%% will be replaced by the contents of the device/state  with device name abc and state def,  or use device id as number
#
# get the connection
plug = indigo.server.getPlugin("com.karlwachs.piBeacon")


## show temp/humidity/pressure on 3 pages scrolling left through and repeat
plug.executeAction("Display" ,
   props ={   
     "outputDev":   "s-14-displayrgb"  # you must have created this before  as indigo device     
   , "resetInitial": ""  # no reset
   , "repeat": 2
    , "scrollxy":"left"
    , "scrollPages":3
    , "scrollDelayBetweenPages":1
    , "scrollDelay":0.02
    , "command":'['
   ' {"type": "hBar","width": "64","fill":"[0, 0, 0]","reset": "", "postion": [0,32,256], "display": "wait"}'+  #  draw a blank bar across teh whole area = reset
   ',{"type": "text","fill":"[50, 50, 50]","reset": "", "postion":[0, 1], "display": "wait", "text":"......", "font": "6x9.pil"}'+  # page0 top
   ',{"type": "text","fill":"[50, 50, 50]","reset": "", "postion":[0, 16], "display": "wait", "text":"......", "font": "8x13.pil"}'+ #page 0 bottom
   ',{"type": "text","fill":"[0, 255, 0]","reset": "", "postion":[64, 1], "display": "wait", "text":" Temp[C]", "font": "6x9.pil"}'+ # page 1 top
   ',{"type": "text","fill":"[0, 255, 0]","reset": "", "postion":[64, 16], "display": "wait", "text":" 21.4", "font": "8x13.pil"}'+  # page 1 bottom
   ',{"type": "text","fill":"[0, 0, 255]","reset": "", "postion":[128, 1], "display": "wait", "text":"  Hum[%]", "font": "6x9.pil"}'+
   ',{"type": "text","fill":"[0, 0, 255]","reset": "", "postion":[128, 16], "display": "wait", "text":"   33", "font": "8x13.pil"}'+
   ',{"type": "text","fill":"[255, 0, 0]","reset": "", "postion":[192, 1], "display": "wait", "text":"P[mBar]", "font": "6x9.pil"}'+
   ',{"type": "text","fill":"[255, 0, 0]","reset": "", "postion":[192, 16], "display": "immediate", "text":"%%v:pressureOutside%%", "font": "8x13.pil"}]'})  ## use variable pressureOutside as to show

## text and horizontal bar no scrolling
plug.executeAction("Display" ,
   props ={   
     "outputDev":   "s-14-displayrgb"  # you must have created this before  as indigo device     
   ,"resetInitial": "[0,0,0]"
    , "command":'['+
    '{"type": "hBar","width": "64","fill":"[0, 0, 0]","reset": "", "postion": [0,32,256], "display": "wait"}'+  # reset the screen
   ',{"type": "hbar","fill":"[100,0,0]", "postion":[0,28,40],"width":"4", "display": "wait"}'+           # draw a horizontal bar at the bottom 40 pixels long at x=0,y=28, 4 pixels wide
   ',{"type": "text","fill":"[50, 50, 50]","postion":[0, 0], "display": "wait", "text":"this goes on top", "font": "6x9.pil"}'+  # show text on top
   ',{"type": "text","fill":"[0, 255, 0]", "postion":[30, 10], "display": "immediate", "text":"%%v:tempvar%%", "font": "6x9.pil"}]'}) # show text in the middle and draw
 

## text and horizontal bar no scrolling same for the small display, only change in fonts
plug.executeAction("Display" ,
   props ={   
     "outputDev":   "otherDisplay"  # you must have created this before  as indigo device     
   ,"resetInitial": "[0,0,0]"
    , "command":'['+
    '{"type": "hBar","width": "64","fill":"0","reset": "", "postion": [0,32,256], "display": "wait"}'+  # reset the screen
   ',{"type": "hbar","fill":"255", "postion":[0,28,40],"width":"4", "display": "wait"}'+           # draw a horizontal bar at the bottom 40 pixels long at x=0,y=28, 4 pixels wide
   ',{"type": "text","fill":"255","postion":[0, 0], "display": "wait", "text":"this goes on top","width":"12", "font":"arial.ttf"}'+  # show text on top
   ',{"type": "text","fill":"255", "postion":[30, 10], "display": "immediate", "text":"%%v:tempvar%%","width":"28", "font":"arial.ttf"}]'}) # show text in the middle and draw
 



## show histogram on smaller display 128x64
plug.executeAction("Display" ,
   props ={   
     "outputDev":   "otherDisplay"  # you must have created this before  as indigo device     
   ,"resetInitial": "[0,0,0]"
    , "command":'['+
    '{"type": "hBar","width": "64","fill":"0","reset": "", "postion":255, "display": "wait"}'+  # reset the screen
   ',{"type": "hist","fill":"255", "postion":[0,28,40,10,4,6,12,30],"width":"4", "display": "wait"}'+         
   ',{"type": "text","fill":"255", "postion":[0, 0], "display": "immediate", "text":"%%v:tempvar%%","width":"12", "font":"arial.ttf"}]'}) # show text on top
 


## show hBar with box  on smaller display 128x64
plug.executeAction("Display" ,
   props ={   
     "outputDev":   "otherDisplay"  # you must have created this before  as indigo device     
   ,"resetInitial": "[0,0,0]"
    , "command":'['+
    '{"type": "hBar","width": "64","fill":"0","reset": "", "postion": 255, "display": "wait"}'+  # reset the screen
   ',{"type": "hBarwBox","fill":"255", "postion":[0,20,40,100],"width":"10", "display": "wait"}'+           
   ',{"type": "text","fill":"255", "postion":[0, 0], "display": "immediate", "text":"%%v:tempvar%%","width":"12", "font":"arial.ttf"}]'}) # show text on top and draw

## show image and text  on smaller display 128x64
plug.executeAction("Display" ,
   props ={   
     "outputDev":   "otherDisplay"  # you must have created this before  as indigo device     
   ,"resetInitial": "[0,0,0]"
    , "command":'['+
    '{"type": "hBar","width": "64","fill":"0","reset": "", "postion": 255, "display": "wait"}'+  # reset the screen
   ',{"type": "image","text":"nameOfimageFile", "postion":[20,20], "display": "wait"}'+     ',{"type": "text","fill":"255", "postion":[0, 0],"display":"immediate","text":"%%v:tempvar%%","width":"12", "font":"arial.ttf"}]'}) # show text on top and draw
 

Posted on
Sat Jan 21, 2017 9:06 pm
kw123 offline
User avatar
Posts: 5838
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: 14- display

updated the examples

Karl

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest